Fix segfault in loadDefinition for unit tests (#705)

`module` can be empty if the definition file has syntax errors
This commit is contained in:
JohnnyMorganz 2022-10-14 15:28:54 +01:00 committed by GitHub
parent d6aa35583e
commit ff736fd3e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -429,7 +429,8 @@ LoadDefinitionFileResult Fixture::loadDefinition(const std::string& source)
LoadDefinitionFileResult result = frontend.loadDefinitionFile(source, "@test");
freeze(typeChecker.globalTypes);
dumpErrors(result.module);
if (result.module)
dumpErrors(result.module);
REQUIRE_MESSAGE(result.success, "loadDefinition: unable to load definition file");
return result;
}