diff --git a/MapStatistics.cs b/MapStatistics.cs index c8733e66..4c01a5db 100644 --- a/MapStatistics.cs +++ b/MapStatistics.cs @@ -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 == "")) @@ -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;