summaryrefslogtreecommitdiff
path: root/modules/gdscript
diff options
context:
space:
mode:
authorGeorge Marques <george@gmarqu.es>2020-11-27 11:03:20 -0300
committerGitHub <noreply@github.com>2020-11-27 11:03:20 -0300
commitcf7a6be1db073048d8693cf92dd8e3142775b24b (patch)
treeaf9f5347c93d9b9dd8103959eec261cbb8cab9c5 /modules/gdscript
parent0b0b3d9b5a1333bd3bf8046762f1a8f39060ebfe (diff)
parent531958b2f03f7130bb370e50059faf71b3d33cda (diff)
Merge pull request #43226 from mateosss/unreachable-prop-crash
Fix crash due to unreachable code in properties
Diffstat (limited to 'modules/gdscript')
-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 fde3662d66..a74fc7193a 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