Add check in CompressedTextureLayered::get_layer_data
to prevent crash
This commit is contained in:
parent
907db8eebc
commit
1b2a838e21
1 changed files with 1 additions and 0 deletions
|
@ -808,6 +808,7 @@ RID CompressedTextureLayered::get_rid() const {
|
||||||
|
|
||||||
Ref<Image> CompressedTextureLayered::get_layer_data(int p_layer) const {
|
Ref<Image> CompressedTextureLayered::get_layer_data(int p_layer) const {
|
||||||
if (texture.is_valid()) {
|
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);
|
return RS::get_singleton()->texture_2d_layer_get(texture, p_layer);
|
||||||
} else {
|
} else {
|
||||||
return Ref<Image>();
|
return Ref<Image>();
|
||||||
|
|
Loading…
Reference in a new issue