mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-11-28 23:11:58 +00:00
- Don't crash when loading UDMF maps with invalid sidedef references.
SVN r3569 (trunk)
This commit is contained in:
parent
93694dadc1
commit
c1f3621a4c
1 changed files with 22 additions and 8 deletions
|
@ -1438,8 +1438,9 @@ public:
|
||||||
numsides = sidecount;
|
numsides = sidecount;
|
||||||
lines = new line_t[numlines];
|
lines = new line_t[numlines];
|
||||||
sides = new side_t[numsides];
|
sides = new side_t[numsides];
|
||||||
|
int line, side;
|
||||||
|
|
||||||
for(int line = 0, side = 0; line < numlines; line++)
|
for(line = 0, side = 0; line < numlines; line++)
|
||||||
{
|
{
|
||||||
short tempalpha[2] = { SHRT_MIN, SHRT_MIN };
|
short tempalpha[2] = { SHRT_MIN, SHRT_MIN };
|
||||||
|
|
||||||
|
@ -1450,21 +1451,34 @@ public:
|
||||||
if (lines[line].sidedef[sd] != NULL)
|
if (lines[line].sidedef[sd] != NULL)
|
||||||
{
|
{
|
||||||
int mapside = int(intptr_t(lines[line].sidedef[sd]))-1;
|
int mapside = int(intptr_t(lines[line].sidedef[sd]))-1;
|
||||||
sides[side] = ParsedSides[mapside];
|
if (mapside < sidecount)
|
||||||
sides[side].linedef = &lines[line];
|
{
|
||||||
sides[side].sector = §ors[intptr_t(sides[side].sector)];
|
sides[side] = ParsedSides[mapside];
|
||||||
lines[line].sidedef[sd] = &sides[side];
|
sides[side].linedef = &lines[line];
|
||||||
|
sides[side].sector = §ors[intptr_t(sides[side].sector)];
|
||||||
|
lines[line].sidedef[sd] = &sides[side];
|
||||||
|
|
||||||
P_ProcessSideTextures(!isExtended, &sides[side], sides[side].sector, &ParsedSideTextures[mapside],
|
P_ProcessSideTextures(!isExtended, &sides[side], sides[side].sector, &ParsedSideTextures[mapside],
|
||||||
lines[line].special, lines[line].args[0], &tempalpha[sd], missingTex);
|
lines[line].special, lines[line].args[0], &tempalpha[sd], missingTex);
|
||||||
|
|
||||||
side++;
|
side++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lines[line].sidedef[sd] = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
P_AdjustLine(&lines[line]);
|
P_AdjustLine(&lines[line]);
|
||||||
P_FinishLoadingLineDef(&lines[line], tempalpha[0]);
|
P_FinishLoadingLineDef(&lines[line], tempalpha[0]);
|
||||||
}
|
}
|
||||||
|
assert(side <= numsides);
|
||||||
|
if (side < numsides)
|
||||||
|
{
|
||||||
|
Printf("Map had %d invalid side references\n", numsides - side);
|
||||||
|
numsides = side;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
Loading…
Reference in a new issue