diff options
author | MaxStgs <peters2011.pm@gmail.com> | 2021-05-05 21:17:49 +0500 |
---|---|---|
committer | MaxStgs <peters2011.pm@gmail.com> | 2021-05-05 21:17:49 +0500 |
commit | d89d7ecd0805fb807dcaba736c3c0fa3354e909d (patch) | |
tree | 7733b18f9ab6863c23b3b0712236d0be5c101274 /core/io/packed_data_container.cpp | |
parent | 7449d6c752a032024fa9e862efc96c3d36034369 (diff) |
Add PackedDataContainer data pointer check for non nullable
Diffstat (limited to 'core/io/packed_data_container.cpp')
-rw-r--r-- | core/io/packed_data_container.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/core/io/packed_data_container.cpp b/core/io/packed_data_container.cpp index c6354b11b7..52169987fd 100644 --- a/core/io/packed_data_container.cpp +++ b/core/io/packed_data_container.cpp @@ -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); @@ -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); |