- ZDBSP fix: The program could hang on badly set up polyobjects. Now it aborts when the

loop iterates NumberOfSegs times.


SVN r1337 (trunk)
This commit is contained in:
Christoph Oelckers 2008-12-31 09:13:54 +00:00
parent 1d692748f0
commit ba25ef01f6

View file

@ -404,6 +404,7 @@ bool FNodeBuilder::GetPolyExtents (int polynum, fixed_t bbox[4])
{ {
vertex_t start; vertex_t start;
unsigned int vert; unsigned int vert;
unsigned int count = 0;
vert = Segs[i].v1; vert = Segs[i].v1;
@ -415,7 +416,8 @@ bool FNodeBuilder::GetPolyExtents (int polynum, fixed_t bbox[4])
AddSegToBBox (bbox, &Segs[i]); AddSegToBBox (bbox, &Segs[i]);
vert = Segs[i].v2; vert = Segs[i].v2;
i = Vertices[vert].segs; i = Vertices[vert].segs;
} while (i != DWORD_MAX && (Vertices[vert].x != start.x || Vertices[vert].y != start.y)); count++; // to prevent endless loops. Stop when this reaches the number of segs.
} while (i != DWORD_MAX && (Vertices[vert].x != start.x || Vertices[vert].y != start.y) && count < Segs.Size());
return true; return true;
} }