Commit 5753d80c authored by Milian Wolff's avatar Milian Wolff

Check type before accessing it

BUG: 421509
parent 1e0c1d18
......@@ -560,7 +560,7 @@ void DeclarationBuilder::visitClassVariable(ClassVariableAst *node)
Q_ASSERT(currentContext()->type() == DUContext::Class);
foreach(Declaration * dec, currentContext()->findLocalDeclarations(name.first(), startPos(node)))
{
if (wasEncountered(dec) && !dec->isFunctionDeclaration() && !(dec->abstractType()->modifiers() & AbstractType::ConstModifier)) {
if (wasEncountered(dec) && !dec->isFunctionDeclaration() && dec->abstractType() && !(dec->abstractType()->modifiers() & AbstractType::ConstModifier)) {
reportRedeclarationError(dec, node);
break;
}
......@@ -638,7 +638,7 @@ void DeclarationBuilder::visitConstantDeclaration(ConstantDeclarationAst *node)
// check for redeclarations
foreach(Declaration * dec, currentContext()->findLocalDeclarations(identifierForNode(node->identifier).first(), startPos(node->identifier)))
{
if (wasEncountered(dec) && !dec->isFunctionDeclaration() && dec->abstractType()->modifiers() & AbstractType::ConstModifier) {
if (wasEncountered(dec) && !dec->isFunctionDeclaration() && dec->abstractType() && dec->abstractType()->modifiers() & AbstractType::ConstModifier) {
reportRedeclarationError(dec, node->identifier);
break;
}
......@@ -678,7 +678,7 @@ void DeclarationBuilder::visitClassConstantDeclaration(ClassConstantDeclarationA
// check for redeclarations
foreach(Declaration * dec, currentContext()->findLocalDeclarations(identifierForNode(node->identifier).first(), startPos(node->identifier)))
{
if (wasEncountered(dec) && !dec->isFunctionDeclaration() && dec->abstractType()->modifiers() & AbstractType::ConstModifier) {
if (wasEncountered(dec) && !dec->isFunctionDeclaration() && dec->abstractType() && dec->abstractType()->modifiers() & AbstractType::ConstModifier) {
reportRedeclarationError(dec, node->identifier);
break;
}
......
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