Skip to content

Commit

Permalink
Merge pull request #351 from andrewschultz/dangling-connection-exception
Browse files Browse the repository at this point in the history
check for null ports in diagonal/bent (correct source this time)
  • Loading branch information
JasonLautzenheiser authored Jul 2, 2017
2 parents ef6ab36 + 719245d commit 6376574
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions MapStatistics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,9 @@ public static int DiagonalConnections(int checkval)
var port1 = (Room.CompassPort)p.VertexList[0].Port;
var port2 = (Room.CompassPort)p.VertexList[1].Port;

var firstRoomConnectionDir = (int)port1?.CompassPoint;
var secondRoomConnectionDir = (int)port2?.CompassPoint;
var firstRoomConnectionDir = (port1 == null) ? 0 : (int)port1?.CompassPoint;
var secondRoomConnectionDir = (port2 == null) ? 0 : (int)port2?.CompassPoint;

var diags = 0;

if ((firstRoomConnectionDir % 4 == 2) && (p.VertexList[0].Connection.StartText == ""))
Expand All @@ -227,6 +228,9 @@ public static int BentConnections(bool ignoreAnnos)
var port1 = (Room.CompassPort)p.VertexList[0].Port;
var port2 = (Room.CompassPort)p.VertexList[1].Port;

if (port1 == null || port2 == null)
return false;

var firstRoomConnectionDir = port1.CompassPoint;
var secondRoomConnectionDir = port2.CompassPoint;

Expand Down

0 comments on commit 6376574

Please sign in to comment.