From bb9185ef8ae76a1ff4e1ffc10e3ad2be7323fbf5 Mon Sep 17 00:00:00 2001 From: Xjph Date: Sun, 29 May 2022 21:52:44 -0230 Subject: [PATCH] Guard against empty rings array. --- ObservatoryExplorer/DefaultCriteria.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ObservatoryExplorer/DefaultCriteria.cs b/ObservatoryExplorer/DefaultCriteria.cs index 5a51699..3afe5f2 100644 --- a/ObservatoryExplorer/DefaultCriteria.cs +++ b/ObservatoryExplorer/DefaultCriteria.cs @@ -87,7 +87,7 @@ namespace Observatory.Explorer results.Add("Close Orbit", $"Orbital Radius: {scan.SemiMajorAxis / 1000:N0}km, Parent Radius: {parent.Radius / 1000:N0}km"); } - if (settings.ShepherdMoon && !isRing && parent.Rings?.Last().OuterRad > scan.SemiMajorAxis && !parent.Rings.Last().Name.Contains("Belt")) + if (settings.ShepherdMoon && !isRing && parent.Rings?.Any() == true && parent.Rings.Last().OuterRad > scan.SemiMajorAxis && !parent.Rings.Last().Name.Contains("Belt")) { results.Add("Shepherd Moon", $"Orbit: {scan.SemiMajorAxis / 1000:N0}km, Ring Radius: {parent.Rings.Last().OuterRad / 1000:N0}km"); }