From e417528f67caf550f4b343a721bb9dd695b36795 Mon Sep 17 00:00:00 2001 From: Thakee Nathees Date: Thu, 30 Apr 2020 17:35:53 +0530 Subject: [PATCH] fix: dict2inst crash when constructor has arguments (cherry picked from commit 9f6b20936e504b7d2cdb0a6fe9d7b3c33dd4ea86) --- modules/gdscript/gdscript_functions.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/gdscript/gdscript_functions.cpp b/modules/gdscript/gdscript_functions.cpp index 01d62a1c62d..2d3812fc8c1 100644 --- a/modules/gdscript/gdscript_functions.cpp +++ b/modules/gdscript/gdscript_functions.cpp @@ -1207,6 +1207,11 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_ r_ret = gdscr->_new(NULL, 0, r_error); + if (r_error.error != Variant::CallError::CALL_OK) { + r_ret = Variant(); + return; + } + GDScriptInstance *ins = static_cast(static_cast(r_ret)->get_script_instance()); Ref gd_ref = ins->get_script();