forked from qt-creator/qt-creator
CppQuickFixes: Fix possible null dereference
It may happen that we dereference null inside the following condition: if (declarator->postfix_declarator_list) This may happen in case we entered the "if (!declarator)" condition, but didn't fulfill the nested "if (path.at(n - i++)->asPointer())" condition. Detected by clazy analyzer. Change-Id: I47135bc5648459e91664a4f65f9752b58248a496 Reviewed-by: David Schulz <david.schulz@qt.io> Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
@@ -4310,6 +4310,8 @@ void GenerateGetterSetter::match(const CppQuickFixInterface &interface, QuickFix
|
|||||||
return;
|
return;
|
||||||
declarator = path.at(n - i++)->asDeclarator();
|
declarator = path.at(n - i++)->asDeclarator();
|
||||||
}
|
}
|
||||||
|
if (!declarator)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
const auto variableDecl = path.at(n - i++)->asSimpleDeclaration();
|
const auto variableDecl = path.at(n - i++)->asSimpleDeclaration();
|
||||||
const auto classSpecifier = path.at(n - i++)->asClassSpecifier();
|
const auto classSpecifier = path.at(n - i++)->asClassSpecifier();
|
||||||
|
|||||||
Reference in New Issue
Block a user