1
0
mirror of https://github.com/godotengine/godot.git synced 2026-01-04 19:21:46 +00:00

Prevent encode_variant doing memcpy from nullptr

This commit is contained in:
A Thousand Ships
2023-10-29 17:59:44 +01:00
parent 9144457484
commit 210461f2ed

View File

@@ -1621,8 +1621,10 @@ Error encode_variant(const Variant &p_variant, uint8_t *r_buffer, int &r_len, bo
encode_uint32(datalen, buf);
buf += 4;
const uint8_t *r = data.ptr();
memcpy(buf, &r[0], datalen * datasize);
buf += datalen * datasize;
if (r) {
memcpy(buf, &r[0], datalen * datasize);
buf += datalen * datasize;
}
}
r_len += 4 + datalen * datasize;