From 1b2a838e212afaaa1078c10ac15c6ea7e8021e1d Mon Sep 17 00:00:00 2001 From: jsjtxietian Date: Fri, 16 Feb 2024 22:41:05 +0800 Subject: [PATCH] Add check in `CompressedTextureLayered::get_layer_data` to prevent crash --- scene/resources/compressed_texture.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/scene/resources/compressed_texture.cpp b/scene/resources/compressed_texture.cpp index f4395d5c7dc..588a2b967b1 100644 --- a/scene/resources/compressed_texture.cpp +++ b/scene/resources/compressed_texture.cpp @@ -808,6 +808,7 @@ RID CompressedTextureLayered::get_rid() const { Ref CompressedTextureLayered::get_layer_data(int p_layer) const { if (texture.is_valid()) { + ERR_FAIL_INDEX_V(p_layer, get_layers(), Ref()); return RS::get_singleton()->texture_2d_layer_get(texture, p_layer); } else { return Ref();