From 396a6d8a86f265c5fbb437b498b708a2f687a6f2 Mon Sep 17 00:00:00 2001 From: Ulysse Martin Date: Fri, 30 Sep 2016 07:40:17 +0200 Subject: [PATCH] UPBGE: Fix crash when calling shade_light texture when mtex has no tex. --- source/blender/gpu/intern/gpu_material.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/blender/gpu/intern/gpu_material.c b/source/blender/gpu/intern/gpu_material.c index ed9718f1a17..b857aea29ad 100644 --- a/source/blender/gpu/intern/gpu_material.c +++ b/source/blender/gpu/intern/gpu_material.c @@ -804,7 +804,7 @@ static void shade_light_textures(GPUMaterial *mat, GPULamp *lamp, GPUNodeLink ** for (int i = 0; i < MAX_MTEX; ++i) { MTex *mtex = lamp->la->mtex[i]; - if (mtex && mtex->tex->type & TEX_IMAGE && mtex->tex->ima) { + if (mtex && mtex->tex && (mtex->tex->type & TEX_IMAGE) && mtex->tex->ima) { mat->dynproperty |= DYN_LAMP_PERSMAT; float one = 1.0f;