Removed string.Empty

This commit is contained in:
ClemensFischer 2024-07-12 18:42:18 +02:00
parent e67d7ee1e3
commit 37b3809b8f
6 changed files with 13 additions and 17 deletions

View file

@ -84,20 +84,16 @@ namespace MapControl
var styleElement = layerElement
.Elements(wmts + "Style")
.FirstOrDefault(s => s.Attribute("isDefault")?.Value == "true");
if (styleElement == null)
{
styleElement = layerElement
.Elements(wmts + "Style")
.FirstOrDefault();
}
.FirstOrDefault(s => s.Attribute("isDefault")?.Value == "true")
?? layerElement
.Elements(wmts + "Style")
.FirstOrDefault();
var style = styleElement?.Element(ows + "Identifier")?.Value;
if (string.IsNullOrEmpty(style))
{
throw new ArgumentException($"No Style element found in Layer \"{layer}\".");
style = "default";
}
var urlTemplate = ReadUrlTemplate(capabilitiesElement, layerElement, layer, style, capabilitiesUrl);