diff options
Diffstat (limited to 'core/variant.cpp')
-rw-r--r-- | core/variant.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/core/variant.cpp b/core/variant.cpp index 8b2051add7..56b272cccf 100644 --- a/core/variant.cpp +++ b/core/variant.cpp @@ -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) { |