Fix debugger error when Dictionary key is a freed Object

This commit is contained in:
Pedro J. Estébanez 2020-06-28 02:36:13 +02:00
parent 6a9fbafcbb
commit b02e0b0c4b
1 changed files with 3 additions and 4 deletions

View File

@ -1169,15 +1169,14 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
while (r_len%4) while (r_len%4)
r_len++; //pad r_len++; //pad
*/ */
Variant *v = d.getptr(E->get());
int len; 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); ERR_FAIL_COND_V(len % 4, ERR_BUG);
r_len += len; r_len += len;
if (buf) if (buf)
buf += len; buf += len;
Variant *v = d.getptr(E->get()); encode_variant(v ? *v : Variant(), buf, len, p_full_objects);
ERR_FAIL_COND_V(!v, ERR_BUG);
encode_variant(*v, buf, len, p_full_objects);
ERR_FAIL_COND_V(len % 4, ERR_BUG); ERR_FAIL_COND_V(len % 4, ERR_BUG);
r_len += len; r_len += len;
if (buf) if (buf)