You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-05 12:10:55 +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:
@@ -1561,14 +1561,14 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
|
|||||||
//error
|
//error
|
||||||
// function, file, line, error, explanation
|
// function, file, line, error, explanation
|
||||||
String err_file;
|
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;
|
err_file = p_instance->script->path;
|
||||||
else if (script)
|
else if (script)
|
||||||
err_file = script->path;
|
err_file = script->path;
|
||||||
if (err_file == "")
|
if (err_file == "")
|
||||||
err_file = "<built-in>";
|
err_file = "<built-in>";
|
||||||
String err_func = name;
|
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;
|
err_func = p_instance->script->name + "." + err_func;
|
||||||
int err_line = line;
|
int err_line = line;
|
||||||
if (err_text == "") {
|
if (err_text == "") {
|
||||||
|
|||||||
Reference in New Issue
Block a user