Fix crash due to unreachable code in properties

This commit is contained in:
Mateo de Mayo 2020-10-30 22:21:50 -03:00
parent 41f66761fd
commit 531958b2f0

View file

@ -1421,7 +1421,11 @@ GDScriptParser::Node *GDScriptParser::parse_statement() {
#ifdef DEBUG_ENABLED
if (unreachable) {
current_suite->has_unreachable_code = true;
push_warning(result, GDScriptWarning::UNREACHABLE_CODE, current_function->identifier->name);
if (current_function) {
push_warning(result, GDScriptWarning::UNREACHABLE_CODE, current_function->identifier->name);
} else {
// TODO: Properties setters and getters with unreachable code are not being warned
}
}
#endif