diff --git a/src/p_udmf.cpp b/src/p_udmf.cpp index 81b1d0a90..7952d2a92 100644 --- a/src/p_udmf.cpp +++ b/src/p_udmf.cpp @@ -1934,10 +1934,17 @@ public: P_AdjustLine(&lines[line]); P_FinishLoadingLineDef(&lines[line], tempalpha[0]); } - assert((unsigned)side <= level.sides.Size()); - if ((unsigned)side > level.sides.Size()) + + const int sideDelta = level.sides.Size() - side; + assert(sideDelta >= 0); + + if (sideDelta < 0) { - Printf("Map had %d invalid side references\n", (int)level.sides.Size() - side); + Printf("Map had %d invalid side references\n", abs(sideDelta)); + } + else if (sideDelta > 0) + { + level.sides.Resize(side); } }