Fixed crash caused by 0-length lines in UDMF

When line was removed during processing bogus entries remained in sidedefs array
This commit is contained in:
alexey.lysiuk 2017-04-24 15:57:30 +03:00
parent f97efefe7e
commit 2bb16c684f

View file

@ -1934,10 +1934,17 @@ public:
P_AdjustLine(&lines[line]); P_AdjustLine(&lines[line]);
P_FinishLoadingLineDef(&lines[line], tempalpha[0]); 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);
} }
} }