mirror of
https://git.do.srb2.org/STJr/ZoneBuilder.git
synced 2024-11-10 06:41:49 +00:00
Add safeguards to prevent crashes from invalid flat alignment lines
This commit is contained in:
parent
ccd15d6f94
commit
69b2faa96e
2 changed files with 17 additions and 2 deletions
|
@ -23,6 +23,8 @@ using System.Windows.Forms;
|
|||
using CodeImp.DoomBuilder.Config;
|
||||
using CodeImp.DoomBuilder.Map;
|
||||
using CodeImp.DoomBuilder.Types;
|
||||
using SlimDX.Direct3D9;
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
@ -504,7 +506,7 @@ namespace CodeImp.DoomBuilder.Windows
|
|||
s.UpdateCeilingSurface();
|
||||
}
|
||||
}
|
||||
if (l.Front.Sector != null)
|
||||
if (l.Front != null && l.Front.Sector != null)
|
||||
{
|
||||
l.Front.Sector.UpdateFloorSurface();
|
||||
l.Front.Sector.UpdateCeilingSurface();
|
||||
|
|
|
@ -330,7 +330,20 @@ namespace CodeImp.DoomBuilder.BuilderModes
|
|||
private void HandleSurfaceFlatAlignment(Linedef l, Sector s, FlatVertex[] vertices, ImageData img)
|
||||
{
|
||||
bool useoffsets = l.IsFlagSet("8192");
|
||||
float xoffset = useoffsets ? l.Front.OffsetX : -l.Start.Position.x;
|
||||
|
||||
if (useoffsets && l.Front == null)
|
||||
{
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Flat alignment line is set to use offsets, but doesn't have a front side!");
|
||||
return;
|
||||
}
|
||||
|
||||
if (s == null)
|
||||
{
|
||||
General.Interface.DisplayStatus(StatusType.Warning, "Flat alignment line points to a non-existent sector!");
|
||||
return;
|
||||
}
|
||||
|
||||
float xoffset = useoffsets ? l.Front.OffsetX : -l.Start.Position.x;
|
||||
float yoffset = useoffsets ? -l.Front.OffsetY : -l.Start.Position.y;
|
||||
float rotation = General.ClampAngle(90f - l.Angle * Angle2D.PIDEG);
|
||||
|
||||
|
|
Loading…
Reference in a new issue