From 823d8b6dad41afddcc865ef559a7baae41a0c1fa Mon Sep 17 00:00:00 2001 From: ssszcmawo Date: Wed, 28 Jan 2026 21:30:42 +0100 Subject: [PATCH] Added a check to ensure the material has a valid texture --- src/rmodels.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/rmodels.c b/src/rmodels.c index 2988dfaba..ad5d66e3c 100644 --- a/src/rmodels.c +++ b/src/rmodels.c @@ -2228,10 +2228,14 @@ bool IsMaterialValid(Material material) { bool result = false; - if ((material.maps != NULL) && // Validate material contain some map - (material.shader.id > 0)) result = true; // Validate material shader is valid + bool hasValidShader = ((material.maps != NULL) && // Validate material contain some maps + (material.shader.id > 0)); // Validate material shader is valid - // TODO: Check if available maps contain loaded textures + bool hasValidTexture = ((material.maps != NULL) && // Validate material contain some maps + (material.maps->texture.id > 0)); // Validate material texture is valid + + if (hasValidShader && hasValidTexture) + result = true; return result; }