aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--code/renderer/tr_shader.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/code/renderer/tr_shader.c b/code/renderer/tr_shader.c
index 7e9a37e..cb040a2 100644
--- a/code/renderer/tr_shader.c
+++ b/code/renderer/tr_shader.c
@@ -2566,7 +2566,14 @@ qhandle_t RE_RegisterShaderFromImage(const char *name, int lightmapIndex, image_
shader_t *sh;
hash = generateHashValue(name, FILE_HASH_SIZE);
-
+
+ // 20051020 misantropia -- probably not necessary since this function
+ // only gets called from tr_font.c with lightmapIndex == LIGHTMAP_2D
+ // but better safe than sorry.
+ if ( lightmapIndex >= tr.numLightmaps ) {
+ lightmapIndex = LIGHTMAP_WHITEIMAGE;
+ }
+
//
// see if the shader is already loaded
//