From 20fbe4ffdf23cd79ff788f6841daceafa46e166e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C3=ABl=20Mora?= Date: Wed, 5 Aug 2020 14:00:24 +0200 Subject: [PATCH] EfficientSugiyamaLayoutAlgorithm Sweeping crashfix Avoid sweeping crash when less than 2 layers. --- .../EfficientSugiyamaAlgorithm.DoCrossingMinimizations.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/GraphShape/Algorithms/Layout/Simple/Hierarchical/EfficientSugiyamaAlgorithm.DoCrossingMinimizations.cs b/src/GraphShape/Algorithms/Layout/Simple/Hierarchical/EfficientSugiyamaAlgorithm.DoCrossingMinimizations.cs index b4ac68b..615e907 100644 --- a/src/GraphShape/Algorithms/Layout/Simple/Hierarchical/EfficientSugiyamaAlgorithm.DoCrossingMinimizations.cs +++ b/src/GraphShape/Algorithms/Layout/Simple/Hierarchical/EfficientSugiyamaAlgorithm.DoCrossingMinimizations.cs @@ -29,6 +29,9 @@ public partial class EfficientSugiyamaLayoutAlgorithm /// private void DoCrossingMinimizations() { + if (_layers.Count < 2) + return; + int prevCrossings = int.MaxValue; int crossings = int.MaxValue; int phase = 1;