Skip to content

Commit

Permalink
Add check in CompressedTextureLayered::get_layer_data to prevent crash
Browse files Browse the repository at this point in the history
  • Loading branch information
jsjtxietian committed Feb 16, 2024
1 parent 907db8e commit 1b2a838
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions scene/resources/compressed_texture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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>();
Expand Down

0 comments on commit 1b2a838

Please sign in to comment.