From 1c6bae1eb7d4e68fb517d804a9eb5d536869fd71 Mon Sep 17 00:00:00 2001 From: myT Date: Thu, 6 Jul 2017 05:41:03 +0200 Subject: [PATCH] fixed a NULL pointer dereference crash in RB_CalcDiffuseColor --- code/renderer/tr_shade_calc.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/code/renderer/tr_shade_calc.cpp b/code/renderer/tr_shade_calc.cpp index ffa235e..2b9e9e3 100644 --- a/code/renderer/tr_shade_calc.cpp +++ b/code/renderer/tr_shade_calc.cpp @@ -1044,7 +1044,11 @@ void RB_CalcDiffuseColor( unsigned char *colors ) vec3_t lightDir; vec3_t directedLight; int numVertexes; + ent = backEnd.currentEntity; + if (!ent || !tess.numVertexes) + return; + ambientLightInt = ent->ambientLightInt; VectorCopy( ent->ambientLight, ambientLight ); VectorCopy( ent->directedLight, directedLight );