Merge pull request #43226 from mateosss/unreachable-prop-crash

Fix crash due to unreachable code in properties
This commit is contained in:
George Marques 2020-11-27 11:03:20 -03:00 committed by GitHub
commit cf7a6be1db
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

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