From 7095a71c0239fac8402dce89498abdacbe59beb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Sun, 28 Oct 2018 01:58:39 +0200 Subject: [PATCH] Fix GDScript assuming awareness of whole ClassDB --- modules/gdscript/gdscript_editor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 7355cb646fa..068e8d2d928 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::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;