OverrideSpecifier: Check for null before dereferencing

This commit is contained in:
Mathias Baumann
2021-02-04 13:17:28 +01:00
committed by chriseth
parent d393624384
commit 3a8a74cbc7
3 changed files with 15 additions and 3 deletions
+2 -3
View File
@@ -225,13 +225,12 @@ struct OverrideSpecifierChecker: public PostTypeChecker::Checker
if (dynamic_cast<ContractDefinition const*>(decl))
continue;
TypeType const* actualTypeType = dynamic_cast<TypeType const*>(decl->type());
auto const* typeType = dynamic_cast<TypeType const*>(decl->type());
m_errorReporter.typeError(
9301_error,
override->location(),
"Expected contract but got " +
actualTypeType->actualType()->toString(true) +
(typeType ? typeType->actualType() : decl->type())->toString(true) +
"."
);
}