From 66a6cceaf40cbadc6f3f86960ccd8fe9d68ac15b Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Thu, 10 Aug 2023 15:23:17 +0200 Subject: [PATCH] CppEditor: Fix possible null pointer access Fixes: QTCREATORBUG-29484 Change-Id: I047ea13e6808902a3b0fb94b9eacdd48e411a22a Reviewed-by: David Schulz --- src/plugins/cppeditor/cpprefactoringchanges.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/cppeditor/cpprefactoringchanges.cpp b/src/plugins/cppeditor/cpprefactoringchanges.cpp index bb34174d06a..f27c0ce83c4 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();