Skip to content

Commit ed07bf2

Browse files
committed
Decal: Fix crash when setting empty texture
Fix-up to godotengine#88349.
1 parent 89001f9 commit ed07bf2

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

scene/3d/decal.cpp

+8-8
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ void Decal::set_texture(DecalTexture p_type, const Ref<Texture2D> &p_texture) {
4646
RID texture_rid = p_texture.is_valid() ? p_texture->get_rid() : RID();
4747

4848
#ifdef DEBUG_ENABLED
49-
if (
50-
p_texture->is_class("AnimatedTexture") ||
51-
p_texture->is_class("AtlasTexture") ||
52-
p_texture->is_class("CameraTexture") ||
53-
p_texture->is_class("CanvasTexture") ||
54-
p_texture->is_class("MeshTexture") ||
55-
p_texture->is_class("Texture2DRD") ||
56-
p_texture->is_class("ViewportTexture")) {
49+
if (p_texture.is_valid() &&
50+
(p_texture->is_class("AnimatedTexture") ||
51+
p_texture->is_class("AtlasTexture") ||
52+
p_texture->is_class("CameraTexture") ||
53+
p_texture->is_class("CanvasTexture") ||
54+
p_texture->is_class("MeshTexture") ||
55+
p_texture->is_class("Texture2DRD") ||
56+
p_texture->is_class("ViewportTexture"))) {
5757
WARN_PRINT(vformat("%s cannot be used as a Decal texture (%s). As a workaround, assign the value returned by %s's `get_image()` instead.", p_texture->get_class(), get_path(), p_texture->get_class()));
5858
}
5959
#endif

0 commit comments

Comments
 (0)