diff options
author | sodaJar <sodajar.gd@gmail.com> | 2023-04-24 15:30:51 +0200 |
---|---|---|
committer | Yuri Sizov <yuris@humnom.net> | 2023-04-26 14:50:59 +0200 |
commit | 0132c2995343e72f5a3c77469c518fbab6cf8fa8 (patch) | |
tree | 46f9af4b390dafa853b71eb93eb87a5ca58dad4d /modules/gdscript/gdscript_vm.cpp | |
parent | 389045c691aec6d0331a1b7c19e610fdc860b881 (diff) |
Fix wrong file on function call error
(cherry picked from commit 464a299d2ef352f7b62fde08ec51b7ad824f4948)
Diffstat (limited to 'modules/gdscript/gdscript_vm.cpp')
-rw-r--r-- | modules/gdscript/gdscript_vm.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/modules/gdscript/gdscript_vm.cpp b/modules/gdscript/gdscript_vm.cpp index 83d2ed6010..7098e4cd40 100644 --- a/modules/gdscript/gdscript_vm.cpp +++ b/modules/gdscript/gdscript_vm.cpp @@ -3572,8 +3572,9 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a //error // function, file, line, error, explanation String err_file; - if (p_instance && ObjectDB::get_instance(p_instance->owner_id) != nullptr && p_instance->script->is_valid() && !p_instance->script->path.is_empty()) { - err_file = p_instance->script->path; + bool instance_valid_with_script = p_instance && ObjectDB::get_instance(p_instance->owner_id) != nullptr && p_instance->script->is_valid(); + if (instance_valid_with_script && !get_script()->path.is_empty()) { + err_file = get_script()->path; } else if (script) { err_file = script->path; } @@ -3581,7 +3582,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a err_file = "<built-in>"; } String err_func = name; - if (p_instance && ObjectDB::get_instance(p_instance->owner_id) != nullptr && p_instance->script->is_valid() && !p_instance->script->name.is_empty()) { + if (instance_valid_with_script && !p_instance->script->name.is_empty()) { err_func = p_instance->script->name + "." + err_func; } int err_line = line; |