diff options
author | Juan Linietsky <reduzio@gmail.com> | 2019-01-26 15:41:26 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2019-01-26 15:41:26 -0300 |
commit | c2f59de212546e2005e4cbdde9515599cdaa3b78 (patch) | |
tree | 3b39914a7d38339b2772671bce3e12ef63065b63 /core/variant.cpp | |
parent | b203f80dfce16135d6baced2c118eff5e44a7dcf (diff) | |
download | redot-engine-c2f59de212546e2005e4cbdde9515599cdaa3b78.tar.gz |
Warn of invalid pointer when converting object to RID, closes #19023
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) { |