summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMateo de Mayo <mateodemayo@gmail.com>2020-10-30 22:21:50 -0300
committerMateo de Mayo <mateodemayo@gmail.com>2020-10-30 22:21:50 -0300
commit531958b2f03f7130bb370e50059faf71b3d33cda (patch)
treed792d28d58fa010776a660d334a133f563e053b3 /modules
parent41f66761fd8e41760dbffce9b9a4a4d8ceb7af0b (diff)
Fix crash due to unreachable code in properties
Diffstat (limited to 'modules')
-rw-r--r--modules/gdscript/gdscript_parser.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_parser.cpp b/modules/gdscript/gdscript_parser.cpp
index 2a69db130b..de71c95e7c 100644
--- a/modules/gdscript/gdscript_parser.cpp
+++ b/modules/gdscript/gdscript_parser.cpp
@@ -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