From 55aec0ef1b6a2dc7f202724b3c226c1653a3c2a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Wed, 2 Aug 2017 07:48:11 +0200 Subject: [PATCH] Fix issue detected by Coverity, vt2 is null checked and then dereferenced --- lib/symboldatabase.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/symboldatabase.cpp b/lib/symboldatabase.cpp index 34124c420..dd2950d3c 100644 --- a/lib/symboldatabase.cpp +++ b/lib/symboldatabase.cpp @@ -4836,7 +4836,7 @@ void SymbolDatabase::setValueType(Token *tok, const ValueType &valuetype) bool ternary = parent->str() == ":" && parent->astParent() && parent->astParent()->str() == "?"; if (ternary) { - if (vt1->pointer == vt2->pointer && vt1->type == vt2->type && vt1->sign == vt2->sign) + if (vt2 && vt1->pointer == vt2->pointer && vt1->type == vt2->type && vt1->sign == vt2->sign) setValueType(parent, *vt2); parent = const_cast(parent->astParent()); }