mirror of
https://github.com/tiennm99/godot.git
synced 2026-08-06 20:25:08 +00:00
Warn of invalid pointer when converting object to RID, closes #19023
This commit is contained in:
@@ -1731,6 +1731,14 @@ Variant::operator RID() const {
|
||||
else if (type == OBJECT && !_get_obj().ref.is_null()) {
|
||||
return _get_obj().ref.get_rid();
|
||||
} else if (type == OBJECT && _get_obj().obj) {
|
||||
#ifdef DEBUG_ENABLED
|
||||
if (ScriptDebugger::get_singleton()) {
|
||||
if (!ObjectDB::instance_validate(_get_obj().obj)) {
|
||||
ERR_EXPLAIN("Invalid pointer (object was deleted)");
|
||||
ERR_FAIL_V(RID());
|
||||
};
|
||||
};
|
||||
#endif
|
||||
Variant::CallError ce;
|
||||
Variant ret = _get_obj().obj->call(CoreStringNames::get_singleton()->get_rid, NULL, 0, ce);
|
||||
if (ce.error == Variant::CallError::CALL_OK && ret.get_type() == Variant::_RID) {
|
||||
|
||||
Reference in New Issue
Block a user