mirror of
https://github.com/godotengine/godot.git
synced 2025-10-20 16:33:30 +00:00
GDScript: validate instance before accessing it on error
Make sure the instance is valid before trying to access the script in after an error happened. If the instance is not valid it's possible that the script is invalid as well. Fix #29623
This commit is contained in:
parent
36a785513f
commit
9fcd38fc70
1 changed files with 2 additions and 2 deletions
|
@ -1561,14 +1561,14 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||
//error
|
||||
// function, file, line, error, explanation
|
||||
String err_file;
|
||||
if (p_instance && p_instance->script->is_valid() && p_instance->script->path != "")
|
||||
if (p_instance && ObjectDB::instance_validate(p_instance->owner) && p_instance->script->is_valid() && p_instance->script->path != "")
|
||||
err_file = p_instance->script->path;
|
||||
else if (script)
|
||||
err_file = script->path;
|
||||
if (err_file == "")
|
||||
err_file = "<built-in>";
|
||||
String err_func = name;
|
||||
if (p_instance && p_instance->script->is_valid() && p_instance->script->name != "")
|
||||
if (p_instance && ObjectDB::instance_validate(p_instance->owner) && p_instance->script->is_valid() && p_instance->script->name != "")
|
||||
err_func = p_instance->script->name + "." + err_func;
|
||||
int err_line = line;
|
||||
if (err_text == "") {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue