Address crash when model skins have invalid file names. Affected surfaces will not be drawn, but FPS will plummet as mdloadskin() is called repeatedly. A more optimal solution would either flag the surface as invalid (so the renderers skip it) or reject the entire model when defs are loaded.

http://forums.duke4.net/topic/6031-eduke32-crashes-if-hrp-model-skin-not-available/

git-svn-id: https://svn.eduke32.com/eduke32@3164 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2012-11-15 06:42:57 +00:00
parent a418bec8c2
commit 9b57e0ea51

View file

@ -797,10 +797,14 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
//OSD_Printf("Using def skin 0,0 as fallback, pal=%d\n", pal);
}
else
return 0;
#if 0
{
// fall back to the model-defined texture
if ((unsigned)number >= (unsigned)m->numskins)
number = 0;
// m->skinfn is undefined when md3model_t is cast to md2model_t --> crash
skinfile = m->skinfn + number*64;
texidx = &m->texid[number*(HICEFFECTMASK+1) + hicfxmask(pal)];
Bstrncpyz(fn, m->basepath, BMAX_PATH);
@ -808,6 +812,7 @@ int32_t mdloadskin(md2model_t *m, int32_t number, int32_t pal, int32_t surf)
Bstrcat(fn,skinfile);
//OSD_Printf("Using MD2/MD3 skin (%d) %s, pal=%d\n",number,skinfile,pal);
}
#endif
}
if (!skinfile[0])