From f8de0fa20187178339ec07d819bfe17f9f1bbb49 Mon Sep 17 00:00:00 2001 From: Henk Westhuis Date: Sun, 23 Sep 2018 22:00:06 +0200 Subject: [PATCH] Null exception with #5473 --- .../RevisionGrid/Graph/GraphModel.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/GitUI/UserControls/RevisionGrid/Graph/GraphModel.cs b/GitUI/UserControls/RevisionGrid/Graph/GraphModel.cs index 6d27e94ae4d..008a5f67be5 100644 --- a/GitUI/UserControls/RevisionGrid/Graph/GraphModel.cs +++ b/GitUI/UserControls/RevisionGrid/Graph/GraphModel.cs @@ -387,6 +387,12 @@ private bool MoveNext() for (int curLane = 0; curLane < _laneNodes.Count; curLane++) { LaneJunctionDetail lane = _laneNodes[curLane]; + if (lane == null) + { + // Abort, something went. Try again next time. + return false; + } + if (lane.Count == 0) { continue; @@ -433,6 +439,12 @@ private bool MoveNext() for (int curLane = 0; curLane < _laneNodes.Count; curLane++) { LaneJunctionDetail lane = _laneNodes[curLane]; + if (lane == null) + { + // Abort, something went. Try again next time. + return false; + } + if (lane.Count == 0) { continue; @@ -599,7 +611,7 @@ private int AdvanceLane(int curLane) { for (int i = 0; i < _laneNodes.Count; i++) { - if (_laneNodes[i].Current == addedLane.Current) + if (_laneNodes[i] != null && _laneNodes[i].Current == addedLane.Current) { // We still advance the lane so it gets // marked as processed. @@ -644,7 +656,7 @@ private int AdvanceLane(int curLane) // If any other lanes have this node on top, merge them together for (int i = 0; i < _laneNodes.Count; i++) { - if (i == curLane || curLane >= _laneNodes.Count) + if (i == curLane || curLane >= _laneNodes.Count || _laneNodes[i] == null) { continue; }