Commit 1b90b80f authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

C++: Fix potential crash



If no template is found, findSpecialization will crash

Task-number: QTCREATORBUG-14748
Change-Id: I94b970e6eb994f0a8d85a4b996e52fcff0affef3
Reviewed-by: default avatarNikolai Kosjar <nikolai.kosjar@theqtcompany.com>
parent 99dea548
......@@ -41,6 +41,7 @@
#include <cplusplus/Names.h>
#include <cplusplus/Scope.h>
#include <cplusplus/Control.h>
#include <cplusplus/cppassert.h>
#include <QStack>
#include <QHash>
......@@ -1255,6 +1256,7 @@ LookupScopePrivate *LookupScopePrivate::nestedType(const Name *name, LookupScope
if (baseTemplate)
break;
}
if (baseTemplate) {
if (LookupScopePrivate *specialization =
findSpecialization(baseTemplate, templId, specializations, origin)) {
reference = specialization;
......@@ -1264,6 +1266,7 @@ LookupScopePrivate *LookupScopePrivate::nestedType(const Name *name, LookupScope
}
}
}
}
// let's instantiation be instantiation
nonConstTemplId->setIsSpecialization(false);
}
......@@ -1970,6 +1973,7 @@ FullySpecifiedType CreateBindings::resolveTemplateArgument(Clone &cloner,
unsigned index)
{
FullySpecifiedType ty;
CPP_ASSERT(specialization && instantiation, return ty);
const TypenameArgument *tParam = 0;
if (Symbol *tArgument = specialization->templateParameterAt(index))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment