Skip to content

Commit

Permalink
Fixed crash caused by 0-length lines in UDMF
Browse files Browse the repository at this point in the history
When line was removed during processing bogus entries remained in sidedefs array
  • Loading branch information
alexey-lysiuk committed Apr 24, 2017
1 parent f97efef commit 2bb16c6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/p_udmf.cpp
Expand Up @@ -1934,10 +1934,17 @@ class UDMFParser : public UDMFParserBase
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", abs(sideDelta));
}
else if (sideDelta > 0)
{
Printf("Map had %d invalid side references\n", (int)level.sides.Size() - side);
level.sides.Resize(side);
}
}

Expand Down

0 comments on commit 2bb16c6

Please sign in to comment.