From 476ab9caea632883e6c1a17c0031b52fa607bb4b Mon Sep 17 00:00:00 2001 From: drfrag Date: Fri, 12 Jun 2020 12:26:02 +0200 Subject: [PATCH] - Fixed: check for bad sidedefs was not taking into account sidedef compression. --- src/maploader/maploader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/maploader/maploader.cpp b/src/maploader/maploader.cpp index 961159590c7..1d008f6b344 100644 --- a/src/maploader/maploader.cpp +++ b/src/maploader/maploader.cpp @@ -1675,6 +1675,7 @@ void MapLoader::LoadLineDefs (MapData * map) auto mldf = map->Read(ML_LINEDEFS); int numlines = mldf.Size() / sizeof(maplinedef_t); + int numsides = map->Size(ML_SIDEDEFS) / sizeof(mapsidedef_t); linemap.Resize(numlines); // [RH] Count the number of sidedef references. This is the number of @@ -1743,7 +1744,7 @@ void MapLoader::LoadLineDefs (MapData * map) // cph 2006/09/30 - fix sidedef errors right away. for (int j=0; j < 2; j++) { - if (LittleShort(mld->sidenum[j]) != NO_INDEX && mld->sidenum[j] >= Level->sides.Size()) + if (LittleShort(mld->sidenum[j]) != NO_INDEX && mld->sidenum[j] >= numsides) { mld->sidenum[j] = 0; // dummy sidedef Printf("Linedef %d has a bad sidedef\n", i);