Merge pull request #48486 from MaxStgs/fix_packeddata_master
Add PackedDataContainer data pointer check for non nullable
This commit is contained in:
commit
6fc14e5b31
@ -123,6 +123,7 @@ Variant PackedDataContainer::_get_at_ofs(uint32_t p_ofs, const uint8_t *p_buf, b
|
|||||||
|
|
||||||
uint32_t PackedDataContainer::_type_at_ofs(uint32_t p_ofs) const {
|
uint32_t PackedDataContainer::_type_at_ofs(uint32_t p_ofs) const {
|
||||||
const uint8_t *rd = data.ptr();
|
const uint8_t *rd = data.ptr();
|
||||||
|
ERR_FAIL_COND_V(!rd, 0);
|
||||||
const uint8_t *r = &rd[p_ofs];
|
const uint8_t *r = &rd[p_ofs];
|
||||||
uint32_t type = decode_uint32(r);
|
uint32_t type = decode_uint32(r);
|
||||||
|
|
||||||
@ -149,6 +150,10 @@ int PackedDataContainer::_size(uint32_t p_ofs) const {
|
|||||||
|
|
||||||
Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, bool &err) const {
|
Variant PackedDataContainer::_key_at_ofs(uint32_t p_ofs, const Variant &p_key, bool &err) const {
|
||||||
const uint8_t *rd = data.ptr();
|
const uint8_t *rd = data.ptr();
|
||||||
|
if (!rd) {
|
||||||
|
err = true;
|
||||||
|
ERR_FAIL_COND_V(!rd, Variant());
|
||||||
|
}
|
||||||
const uint8_t *r = &rd[p_ofs];
|
const uint8_t *r = &rd[p_ofs];
|
||||||
uint32_t type = decode_uint32(r);
|
uint32_t type = decode_uint32(r);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user