Skip to content

Commit

Permalink
Merge pull request #48486 from MaxStgs/fix_packeddata_master
Browse files Browse the repository at this point in the history
Add PackedDataContainer data pointer check for non nullable
  • Loading branch information
akien-mga authored May 5, 2021
2 parents 7449d6c + d89d7ec commit 6fc14e5
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions core/io/packed_data_container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
const uint8_t *rd = data.ptr();
ERR_FAIL_COND_V(!rd, 0);
const uint8_t *r = &rd[p_ofs];
uint32_t type = decode_uint32(r);

Expand All @@ -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 {
const uint8_t *rd = data.ptr();
if (!rd) {
err = true;
ERR_FAIL_COND_V(!rd, Variant());
}
const uint8_t *r = &rd[p_ofs];
uint32_t type = decode_uint32(r);

Expand Down

0 comments on commit 6fc14e5

Please sign in to comment.