diff --git a/src/plugins/coreplugin/find/highlightscrollbar.cpp b/src/plugins/coreplugin/find/highlightscrollbar.cpp index c9e8a98eb0a..c7cc690fa93 100644 --- a/src/plugins/coreplugin/find/highlightscrollbar.cpp +++ b/src/plugins/coreplugin/find/highlightscrollbar.cpp @@ -25,6 +25,8 @@ #include "highlightscrollbar.h" +#include + #include #include #include @@ -252,7 +254,7 @@ void HighlightScrollBarOverlay::paintEvent(QPaintEvent *paintEvent) int top = rect.top() + offset + verticalMargin + float(it.key()) / range * rect.height(); const int bottom = top + resultHeight; - if (previousCategory == currentCategory && previousBottom + 1 >= top) { + if (QTC_GUARD(previousRect) && previousCategory == currentCategory && previousBottom + 1 >= top) { // If the previous highlight has the same category and is directly prior to this highlight // we just extend the previous highlight. previousRect->setBottom(bottom - 1);