summaryrefslogtreecommitdiff
path: root/core/io/marshalls.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/io/marshalls.cpp')
-rw-r--r--core/io/marshalls.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp
index fdce9db2a0..17edc4982c 100644
--- a/core/io/marshalls.cpp
+++ b/core/io/marshalls.cpp
@@ -802,10 +802,10 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
}
} break;
case Variant::OBJECT: {
-#ifdef DEBUG_ENABLED
+
// Test for potential wrong values sent by the debugger when it breaks.
- Object *obj = p_variant;
- if (!obj || !ObjectDB::instance_validate(obj)) {
+ Object *obj = p_variant.get_validated_object();
+ if (!obj) {
// Object is invalid, send a NULL instead.
if (buf) {
encode_uint32(Variant::NIL, buf);
@@ -813,7 +813,7 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
r_len += 4;
return OK;
}
-#endif // DEBUG_ENABLED
+
if (!p_full_objects) {
flags |= ENCODE_FLAG_OBJECT_AS_ID;
}
@@ -1127,9 +1127,9 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
} else {
if (buf) {
- Object *obj = p_variant;
+ Object *obj = p_variant.get_validated_object();
ObjectID id;
- if (obj && ObjectDB::instance_validate(obj)) {
+ if (obj) {
id = obj->get_instance_id();
}