Browse Source

Fixes the misleading error message for call_recursive method for TreeItems

(cherry picked from commit c37f6332164380e626ba2f2d6caf056b2e8222bd)
Umang Kalra 4 years ago
parent
commit
f40d46bafc
1 changed files with 7 additions and 0 deletions
  1. 7 0
      modules/gdscript/gdscript_function.cpp

+ 7 - 0
modules/gdscript/gdscript_function.cpp

@@ -1120,6 +1120,13 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
 								OPCODE_BREAK;
 								OPCODE_BREAK;
 							}
 							}
 						}
 						}
+					} else if (methodstr == "call_recursive" && basestr == "TreeItem") {
+						if (argc >= 1) {
+							methodstr = String(*argptrs[0]) + " (via TreeItem.call_recursive)";
+							if (err.error == Variant::CallError::CALL_ERROR_INVALID_ARGUMENT) {
+								err.argument += 1;
+							}
+						}
 					}
 					}
 					err_text = _get_call_error(err, "function '" + methodstr + "' in base '" + basestr + "'", (const Variant **)argptrs);
 					err_text = _get_call_error(err, "function '" + methodstr + "' in base '" + basestr + "'", (const Variant **)argptrs);
 					OPCODE_BREAK;
 					OPCODE_BREAK;