Fix crash in classic GL

GL sometimes crashes when building skins. This probably isn't the correct
fix (finding the situation where fb->tex can become NULL despite fb being
non-null is), but it does kill the segfault. Luckily, this is git and this
commit can just be reverted when the real fix shows up. :)
This commit is contained in:
Jeff Teunissen 2014-10-16 13:45:39 -04:00
parent 396338a543
commit 890c83ff6e

View file

@ -185,6 +185,7 @@ build_skin (skin_t *skin, int cmap)
s = &player_skin;
if (!s->tex) // we haven't loaded the player model yet
return;
texnum = skin_textures + cmap;
fb_texnum = 0;
if (s->fb)
@ -196,13 +197,13 @@ build_skin (skin_t *skin, int cmap)
if (vid.is8bit) {
build_skin_8 (s->tex, texnum, skin_cmap[cmap],
scaled_width, scaled_height, false);
if (s->fb)
if (s->fb && s->fb_tex)
build_skin_8 (s->fb_tex, fb_texnum, skin_cmap[cmap],
scaled_width, scaled_height, true);
} else {
build_skin_32 (s->tex, texnum, skin_cmap[cmap],
scaled_width, scaled_height, false);
if (s->fb)
if (s->fb && s->fb_tex)
build_skin_32 (s->fb_tex, fb_texnum, skin_cmap[cmap],
scaled_width, scaled_height, true);
}