Merge pull request #105546 from Splizard/fix_gdextension_tostring

Fix GDExtension `Object/Node::to_string` to check `is_valid` before returning the result
This commit is contained in:
Thaddeus Crews
2025-04-27 19:21:24 -05:00
2 changed files with 6 additions and 2 deletions

View File

@ -978,8 +978,10 @@ String Object::to_string() {
String ret;
GDExtensionBool is_valid;
_extension->to_string(_extension_instance, &is_valid, &ret);
if (is_valid) {
return ret;
}
}
return "<" + get_class() + "#" + itos(get_instance_id()) + ">";
}

View File

@ -2864,8 +2864,10 @@ String Node::to_string() {
String ret;
GDExtensionBool is_valid;
_get_extension()->to_string(_get_extension_instance(), &is_valid, &ret);
if (is_valid) {
return ret;
}
}
return (get_name() ? String(get_name()) + ":" : "") + Object::to_string();
}