fix: dict2inst crash when constructor has arguments

This commit is contained in:
Thakee Nathees 2020-04-30 17:35:53 +05:30
parent 92d4a0cbd2
commit 9f6b20936e
1 changed files with 5 additions and 0 deletions

View File

@ -1200,6 +1200,11 @@ void GDScriptFunctions::call(Function p_func, const Variant **p_args, int p_arg_
r_ret = gdscr->_new(nullptr, 0, r_error); r_ret = gdscr->_new(nullptr, 0, r_error);
if (r_error.error != Callable::CallError::CALL_OK) {
r_ret = Variant();
return;
}
GDScriptInstance *ins = static_cast<GDScriptInstance *>(static_cast<Object *>(r_ret)->get_script_instance()); GDScriptInstance *ins = static_cast<GDScriptInstance *>(static_cast<Object *>(r_ret)->get_script_instance());
Ref<GDScript> gd_ref = ins->get_script(); Ref<GDScript> gd_ref = ins->get_script();