From b02e0b0c4b8d02ba014dfa0198dfdfe3f9ad29c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Sun, 28 Jun 2020 02:36:13 +0200 Subject: [PATCH] Fix debugger error when Dictionary key is a freed Object --- core/io/marshalls.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/io/marshalls.cpp b/core/io/marshalls.cpp index e847a9cf0c6..32cf3775175 100644 --- a/core/io/marshalls.cpp +++ b/core/io/marshalls.cpp @@ -1169,15 +1169,14 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo while (r_len%4) r_len++; //pad */ + Variant *v = d.getptr(E->get()); int len; - encode_variant(E->get(), buf, len, p_full_objects); + encode_variant(v ? E->get() : Variant("[Deleted Object]"), buf, len, p_full_objects); ERR_FAIL_COND_V(len % 4, ERR_BUG); r_len += len; if (buf) buf += len; - Variant *v = d.getptr(E->get()); - ERR_FAIL_COND_V(!v, ERR_BUG); - encode_variant(*v, buf, len, p_full_objects); + encode_variant(v ? *v : Variant(), buf, len, p_full_objects); ERR_FAIL_COND_V(len % 4, ERR_BUG); r_len += len; if (buf)