From 6c70c4c3587d8dccb9603231a01a6a17b1748808 Mon Sep 17 00:00:00 2001 From: George Marques Date: Mon, 10 Sep 2018 10:50:19 -0300 Subject: [PATCH] GDScript: Fix autocomplete crash when searching default values Fix #21700 --- modules/gdscript/gdscript_editor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/gdscript/gdscript_editor.cpp b/modules/gdscript/gdscript_editor.cpp index 32a76687608..e74193e7acf 100644 --- a/modules/gdscript/gdscript_editor.cpp +++ b/modules/gdscript/gdscript_editor.cpp @@ -1221,7 +1221,7 @@ static bool _guess_identifier_type(const GDScriptCompletionContext &p_context, c int def_from = p_context.function->arguments.size() - p_context.function->default_values.size(); if (i >= def_from) { - int def_idx = def_from - i; + int def_idx = i - def_from; if (p_context.function->default_values[def_idx]->type == GDScriptParser::Node::TYPE_OPERATOR) { const GDScriptParser::OperatorNode *op = static_cast(p_context.function->default_values[def_idx]); if (op->arguments.size() < 2) {