mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-21 01:41:10 +00:00
Fix the gl skin segfault.
This was caused by an out-by one error when setting up the skin: if cmap was 0 then the gl_skin struct would be taken from index -1 of the array and thus cause all sorts of grief.
This commit is contained in:
parent
6e65de251c
commit
1ea74c6269
1 changed files with 8 additions and 7 deletions
|
@ -231,19 +231,20 @@ gl_Skin_SetupSkin (skin_t *skin, int cmap)
|
|||
int changed;
|
||||
glskin_t *s;
|
||||
|
||||
skin->texnum = 0;
|
||||
skin->auxtex = 0;
|
||||
if (!cmap) {
|
||||
return;
|
||||
}
|
||||
// simplify cmap usage (texture offset/array index)
|
||||
cmap--;
|
||||
s = skins + cmap;
|
||||
changed = (s->tex != skin->texels);
|
||||
s->tex = skin->texels;
|
||||
if (!changed) {
|
||||
skin->texnum = 0;
|
||||
skin->auxtex = 0;
|
||||
if (cmap >= 0) {
|
||||
skin->texnum = skin_textures + cmap;
|
||||
if (s->fb)
|
||||
skin->auxtex = skin_fb_textures + cmap;
|
||||
}
|
||||
skin->texnum = skin_textures + cmap;
|
||||
if (s->fb)
|
||||
skin->auxtex = skin_fb_textures + cmap;
|
||||
return;
|
||||
}
|
||||
if (s->tex)
|
||||
|
|
Loading…
Reference in a new issue