From 85496cfadc84ba94487fb303ee70326a15f5d49e Mon Sep 17 00:00:00 2001 From: orbitcowboy Date: Fri, 23 May 2014 18:11:44 +0200 Subject: [PATCH] Fixed CID 1192595: Dereference null return value in checkother. --- lib/checkother.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/checkother.cpp b/lib/checkother.cpp index 862dc1036..f9a90e61a 100644 --- a/lib/checkother.cpp +++ b/lib/checkother.cpp @@ -3169,8 +3169,10 @@ static bool constructorTakesReference(const Scope * const classScope) if (func->isConstructor()) { const Function &constructor = *func; for (std::size_t argnr = 0U; argnr < constructor.argCount(); argnr++) { - if (constructor.getArgumentVar(argnr)->isReference()) + const Variable * const argVar = constructor.getArgumentVar(argnr); + if (argVar && argVar->isReference()) { return true; + } } } }