aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Kandeler <christian.kandeler@qt.io>2023-08-10 15:23:17 +0200
committerChristian Kandeler <christian.kandeler@qt.io>2023-08-10 13:48:39 +0000
commit66a6cceaf40cbadc6f3f86960ccd8fe9d68ac15b (patch)
treee4ad16eae35e5f567d41801be9ed21bfccf44082
parentd2434d90dcae2cc91e8fd22577ce7422635494c5 (diff)
CppEditor: Fix possible null pointer access
Fixes: QTCREATORBUG-29484 Change-Id: I047ea13e6808902a3b0fb94b9eacdd48e411a22a Reviewed-by: David Schulz <david.schulz@qt.io>
-rw-r--r--src/plugins/cppeditor/cpprefactoringchanges.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/plugins/cppeditor/cpprefactoringchanges.cpp b/src/plugins/cppeditor/cpprefactoringchanges.cpp
index bb34174d06..f27c0ce83c 100644
--- a/src/plugins/cppeditor/cpprefactoringchanges.cpp
+++ b/src/plugins/cppeditor/cpprefactoringchanges.cpp
@@ -124,6 +124,9 @@ bool CppRefactoringFile::isCursorOn(unsigned tokenIndex) const
bool CppRefactoringFile::isCursorOn(const AST *ast) const
{
+ if (!ast)
+ return false;
+
QTextCursor tc = cursor();
int cursorBegin = tc.selectionStart();