Skip to content

Commit

Permalink
Fix CTD with UMAPINFO null sky entries
Browse files Browse the repository at this point in the history
  • Loading branch information
dashodanger committed Oct 25, 2023
1 parent 04e63fa commit 4a4b510
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ General Improvements/Changes


Bugs fixed
----------
----------
- Fixed UMAPINFO entries with no sky defined and past the range of stock levels causing a CTD
22 changes: 22 additions & 0 deletions source_files/edge/w_wad.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,28 @@ void W_ReadUMAPINFOLumps(void)
if (!good_epi)
I_Error("MAPINFO: No valid episode found for level %s\n", temp_level->name.c_str());
}
// Validate that important things aren't null/empty (right now it's just the sky until I catch something else - Dasho)
if (temp_level->sky.empty())
{
// Search for first prior mapdef with a sky and fill it in
size_t entry = mapdefs.GetSize() - 1;
for (entry; entry > 0; entry--)
{
if (mapdefs[entry] == temp_level)
break;
}
entry--;
for (entry; entry > 0; entry--)
{
if (!mapdefs[entry]->sky.empty())
{
temp_level->sky = mapdefs[entry]->sky;
break;
}
}
if (temp_level->sky.empty())
I_Error("MAPINFO: No sky defined for %s!\n", temp_level->name.c_str());
}
}

FreeMapList();
Expand Down

0 comments on commit 4a4b510

Please sign in to comment.