Merge pull request #48355 from MaxStgs/3.x
Add PackedDataContainer data pointer check for non nullable
This commit is contained in:
commit
619482472e
1 changed files with 5 additions and 0 deletions
|
@ -120,6 +120,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 {
|
||||||
PoolVector<uint8_t>::Read rd = data.read();
|
PoolVector<uint8_t>::Read rd = data.read();
|
||||||
|
ERR_FAIL_COND_V(!rd.ptr(), 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);
|
||||||
|
|
||||||
|
@ -146,6 +147,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 {
|
||||||
PoolVector<uint8_t>::Read rd = data.read();
|
PoolVector<uint8_t>::Read rd = data.read();
|
||||||
|
if (!rd.ptr()) {
|
||||||
|
err = true;
|
||||||
|
ERR_FAIL_COND_V(!rd.ptr(), 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 a new issue