Skip to content

Commit 4d441bd

Browse files
committed
FlightPlanner: fix kml overlay with no style
1 parent e4200f0 commit 4d441bd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

GCSViews/FlightPlanner.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5148,7 +5148,7 @@ private void processKML(Element Element, Document root = null)
51485148
{
51495149
GMapPolygon kmlpolygon = new GMapPolygon(new List<PointLatLng>(), "kmlpolygon");
51505150

5151-
var colorwidth = GetKMLLineColor(styleurl.OriginalString.TrimStart('#'), root);
5151+
var colorwidth = GetKMLLineColor(styleurl?.OriginalString.TrimStart('#'), root);
51525152
kmlpolygon.Stroke = new Pen(colorwidth.Item1, colorwidth.Item2);
51535153
kmlpolygon.Fill = Brushes.Transparent;
51545154

@@ -5163,7 +5163,7 @@ private void processKML(Element Element, Document root = null)
51635163
{
51645164
GMapRoute kmlroute = new GMapRoute(new List<PointLatLng>(), "kmlroute");
51655165

5166-
var colorwidth = GetKMLLineColor(styleurl.OriginalString.TrimStart('#'), root);
5166+
var colorwidth = GetKMLLineColor(styleurl?.OriginalString.TrimStart('#'), root);
51675167
kmlroute.Stroke = new Pen(colorwidth.Item1, colorwidth.Item2);
51685168

51695169
foreach (var loc in ((LineString)Element2).Coordinates)
@@ -5197,6 +5197,9 @@ private void processKML(Element Element, Document root = null)
51975197

51985198
private (Color,int) GetKMLLineColor(string styleurl, Document root)
51995199
{
5200+
if (string.IsNullOrEmpty(styleurl))
5201+
return (Color.White, 2);
5202+
52005203
var style2 = root.Styles.Where(a => a.Id == styleurl.TrimStart('#')).First();
52015204

52025205
if (style2 is StyleMapCollection)

0 commit comments

Comments
 (0)