forked from qt-creator/qt-creator
TextEditor: Utils: Do not use invalid regular expressions
Having a search inside a document and switching the find options to use regular expressions may end up in lots of warnings regarding using an invalid expression for a match call. Check beforehand to avoid this. Change-Id: Ia929090ae3910ff3fa87b57a5718293d2b6ccd04 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
committed by
David Schulz
parent
4a8b3268dd
commit
d47f8eaff2
@@ -251,6 +251,10 @@ QRegularExpressionMatch FileSearchRegExp::doGuardedMatch(const QString &line, in
|
||||
void FileSearchRegExp::operator()(QFutureInterface<FileSearchResultList> &futureInterface,
|
||||
const FileIterator::Item &item) const
|
||||
{
|
||||
if (!expression.isValid()) {
|
||||
futureInterface.cancel();
|
||||
return;
|
||||
}
|
||||
if (futureInterface.isCanceled())
|
||||
return;
|
||||
futureInterface.setProgressRange(0, 1);
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user