From d383913e1b35267d04e02f34b036ca29d9fe19c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Marjam=C3=A4ki?= Date: Fri, 27 Nov 2020 16:49:25 +0100 Subject: [PATCH] Attempt to fix crashes when variable valueType is nullptr. This can happen when decltype is used on unknown type --- lib/checkclass.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/checkclass.cpp b/lib/checkclass.cpp index 60725e72f..f811bc68f 100644 --- a/lib/checkclass.cpp +++ b/lib/checkclass.cpp @@ -964,7 +964,9 @@ void CheckClass::initializationListUsage() const Variable* var = tok->variable(); if (!var || var->scope() != owner || var->isStatic()) continue; - if (var->isPointer() || var->isReference() || var->isEnumType() || var->valueType()->type > ValueType::Type::ITERATOR) + if (var->isPointer() || var->isReference() || var->isEnumType()) + continue; + if (!WRONG_DATA(!var->valueType(), tok) && var->valueType()->type > ValueType::Type::ITERATOR) continue; // bailout: multi line lambda in rhs => do not warn