Merge pull request #39906 from RandomShaper/fix_dangling_key_dbg_error

Fix debugger error when Dictionary key is a freed Object
This commit is contained in:
Rémi Verschelde 2020-06-28 09:02:41 +02:00 committed by GitHub
commit 429f4830fe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)