diff options
author | jsjtxietian <jsjtxietian@outlook.com> | 2024-02-16 22:41:05 +0800 |
---|---|---|
committer | jsjtxietian <jsjtxietian@outlook.com> | 2024-02-16 22:41:05 +0800 |
commit | 1b2a838e212afaaa1078c10ac15c6ea7e8021e1d (patch) | |
tree | 98662a1926460659ec1fd699255c41bf439326e9 /scene/resources/compressed_texture.cpp | |
parent | 907db8eebcecb97d527edcaff77a1c87a6c068f5 (diff) | |
download | redot-engine-1b2a838e212afaaa1078c10ac15c6ea7e8021e1d.tar.gz |
Add check in `CompressedTextureLayered::get_layer_data` to prevent crash
Diffstat (limited to 'scene/resources/compressed_texture.cpp')
-rw-r--r-- | scene/resources/compressed_texture.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/scene/resources/compressed_texture.cpp b/scene/resources/compressed_texture.cpp index f4395d5c7d..588a2b967b 100644 --- a/scene/resources/compressed_texture.cpp +++ b/scene/resources/compressed_texture.cpp @@ -808,6 +808,7 @@ RID CompressedTextureLayered::get_rid() const { Ref<Image> CompressedTextureLayered::get_layer_data(int p_layer) const { if (texture.is_valid()) { + ERR_FAIL_INDEX_V(p_layer, get_layers(), Ref<Image>()); return RS::get_singleton()->texture_2d_layer_get(texture, p_layer); } else { return Ref<Image>(); |