Prevent `encode_variant` doing `memcpy` from `nullptr`
(cherry picked from commit 210461f2ed
)
This commit is contained in:
parent
3d4f1ce21f
commit
36c7a47b11
|
@ -1619,9 +1619,11 @@ 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();
|
||||
if (r) {
|
||||
memcpy(buf, &r[0], datalen * datasize);
|
||||
buf += datalen * datasize;
|
||||
}
|
||||
}
|
||||
|
||||
r_len += 4 + datalen * datasize;
|
||||
while (r_len % 4) {
|
||||
|
|
Loading…
Reference in New Issue