From f00394b371c1b5663971b853d22ebf54f0a175be Mon Sep 17 00:00:00 2001 From: David Schulz Date: Thu, 30 May 2024 13:41:30 +0200 Subject: [PATCH] TextEditor: avoid setting a null cursor on select all Change-Id: If7ccdf1e1d4846b279305e30d3a990754f942128 Reviewed-by: Christian Stenger --- src/plugins/texteditor/texteditor.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index bea58df3c88..7b066c7bdc7 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -986,6 +986,8 @@ void TextEditorWidgetFind::selectAll(const QString &txt, FindFlags findFlags) if (future.resultCount() <= 0) return; const SearchResultItems &results = future.result(); + if (results.isEmpty()) + return; const auto cursorForResult = [this](const SearchResultItem &item) { return selectRange(m_editor->document(), item.mainRange()); };