Fix some crashes

This commit is contained in:
lachablock 2021-08-09 17:30:05 +10:00
parent f9723a567c
commit f2472d88b8
2 changed files with 8 additions and 6 deletions

View file

@ -492,7 +492,7 @@ void HWR_InitModels(void)
CONS_Printf("HWR_InitModels()...\n"); CONS_Printf("HWR_InitModels()...\n");
if (numskins && md2_playermodels == NULL) if (numskins && md2_playermodels == NULL)
md2_playermodels = Z_Malloc(sizeof(md2_t), PU_STATIC, NULL); md2_playermodels = Z_Malloc(sizeof(md2_t) * numskins, PU_STATIC, NULL);
for (s = 0; s < numskins; s++) for (s = 0; s < numskins; s++)
{ {

View file

@ -239,11 +239,13 @@ void HWR_ReloadModels(void)
size_t i; size_t i;
INT32 s; INT32 s;
for (s = 0; s < numskins; s++) if (md2_playermodels != NULL)
{ for (s = 0; s < numskins; s++)
if (md2_playermodels[s].model) {
LoadModelSprite2(md2_playermodels[s].model); CONS_Printf("%u\n", s);
} if (md2_playermodels[s].model)
LoadModelSprite2(md2_playermodels[s].model);
}
for (i = 0; i < NUMSPRITES; i++) for (i = 0; i < NUMSPRITES; i++)
{ {