diff --git a/src/plugins/texteditor/texteditoroverlay.cpp b/src/plugins/texteditor/texteditoroverlay.cpp index 4a6eda6c2c4..52ab8709de6 100644 --- a/src/plugins/texteditor/texteditoroverlay.cpp +++ b/src/plugins/texteditor/texteditoroverlay.cpp @@ -252,6 +252,8 @@ void TextEditorOverlay::paintSelection(QPainter *painter, return; QPainterPath path = createSelectionPath(begin, end, clip); + if (path.isEmpty()) + return; painter->save(); QColor penColor = fg; @@ -307,6 +309,8 @@ void TextEditorOverlay::fillSelection(QPainter *painter, return; QPainterPath path = createSelectionPath(begin, end, clip); + if (path.isEmpty()) + return; painter->save(); painter->translate(-.5, -.5);