* Fix to potential out of range index bug from misanthropia

This commit is contained in:
Tim Angus 2005-10-20 16:19:43 +00:00
parent 769372e2f9
commit 64f167f183
1 changed files with 8 additions and 1 deletions

View File

@ -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
//