diff --git a/src/libs/utils/filesearch.cpp b/src/libs/utils/filesearch.cpp index 03aa1cf9b20..4af8079adf0 100644 --- a/src/libs/utils/filesearch.cpp +++ b/src/libs/utils/filesearch.cpp @@ -251,6 +251,10 @@ QRegularExpressionMatch FileSearchRegExp::doGuardedMatch(const QString &line, in void FileSearchRegExp::operator()(QFutureInterface &futureInterface, const FileIterator::Item &item) const { + if (!expression.isValid()) { + futureInterface.cancel(); + return; + } if (futureInterface.isCanceled()) return; futureInterface.setProgressRange(0, 1); diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 397281b8b5e..59617e4b6c7 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -4251,7 +4251,7 @@ void TextEditorWidgetPrivate::paintSearchResultOverlay(const PaintEventData &dat QPainter &painter) const { m_searchResultOverlay->clear(); - if (m_searchExpr.pattern().isEmpty()) + if (m_searchExpr.pattern().isEmpty() || !m_searchExpr.isValid()) return; const int margin = 5;