From 70488d40db9a98357f5d147ebc8ceb4e5f642a44 Mon Sep 17 00:00:00 2001 From: HolonProduction Date: Mon, 1 Jul 2024 14:49:39 +0200 Subject: [PATCH] Autocompletion: Don't use `in` operator to decide over variant lookup --- modules/gdscript/gdscript_editor.cpp | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index f5577277180..b58b44973e8 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -1959,11 +1959,14 @@ static bool _guess_expression_type(GDScriptParser::CompletionContext &p_context, break; } - if (base.value.in(index.value)) { - Variant value = base.value.get(index.value); - r_type = _type_from_variant(value, p_context); - found = true; - break; + { + bool valid; + Variant value = base.value.get(index.value, &valid); + if (valid) { + r_type = _type_from_variant(value, p_context); + found = true; + break; + } } // Look if it is a dictionary node.