Skip to content

Commit

Permalink
Fixed: Fatal error if no sprites are found
Browse files Browse the repository at this point in the history
  • Loading branch information
danij-deng committed Jan 4, 2012
1 parent 9781e7f commit 99e92de
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions doomsday/engine/portable/src/r_things.c
Expand Up @@ -547,22 +547,26 @@ void R_InitSprites(void)
* This unobvious requirement should be broken somehow and perhaps even
* get rid of the sprite name definitions entirely.
*/
{ int max = MAX_OF(numSpriteRecords, countSprNames.num);
if(max > 0)
if(numSpriteRecords)
{
spriterecord_t* rec, **list = M_Calloc(sizeof(spriterecord_t*) * max);
int n = max-1;
rec = spriteRecords;
do
int max = MAX_OF(numSpriteRecords, countSprNames.num);
if(max > 0)
{
int idx = Def_GetSpriteNum(rec->name);
list[idx == -1? n-- : idx] = rec;
} while((rec = rec->next));

// Create sprite definitions from the located sprite patch lumps.
initSpriteDefs(list, max);
M_Free(list);
}}
spriterecord_t* rec, **list = M_Calloc(sizeof(spriterecord_t*) * max);
int n = max-1;

rec = spriteRecords;
do
{
int idx = Def_GetSpriteNum(rec->name);
list[idx == -1? n-- : idx] = rec;
} while((rec = rec->next));

// Create sprite definitions from the located sprite patch lumps.
initSpriteDefs(list, max);
M_Free(list);
}
}
/// \kludge end

// We are now done with the sprite records.
Expand Down

0 comments on commit 99e92de

Please sign in to comment.