summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2018-10-28 01:58:39 +0200
committerPedro J. Estébanez <pedrojrulez@gmail.com>2018-10-28 03:07:35 +0100
commit7095a71c0239fac8402dce89498abdacbe59beb3 (patch)
tree21f47d1295e1787abe0a3d6802029f34f9b85d70
parentf39ea99c081a3a1db2455efc2520b9c3a013cd9f (diff)
Fix GDScript assuming awareness of whole ClassDB
-rw-r--r--modules/gdscript/gdscript_editor.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp
index 7355cb646f..068e8d2d92 100644
--- a/modules/gdscript/gdscript_editor.cpp
+++ b/modules/gdscript/gdscript_editor.cpp
@@ -1330,7 +1330,12 @@ static bool _guess_identifier_type(const GDScriptCompletionContext &p_context, c
r_type.value = Engine::get_singleton()->get_singleton_object(target_id);
} else {
r_type.type.is_meta_type = true;
- int idx = GDScriptLanguage::get_singleton()->get_global_map()[target_id];
+ const Map<StringName, int>::Element *target_elem = GDScriptLanguage::get_singleton()->get_global_map().find(target_id);
+ // Check because classes like EditorNode are in ClassDB by now, but unknown to GDScript
+ if (!target_elem) {
+ return false;
+ }
+ int idx = target_elem->get();
r_type.value = GDScriptLanguage::get_singleton()->get_global_array()[idx];
}
return true;