diff --git a/lib/src/gpx_reader.dart b/lib/src/gpx_reader.dart index 2b2f94a..b2b2242 100644 --- a/lib/src/gpx_reader.dart +++ b/lib/src/gpx_reader.dart @@ -439,9 +439,11 @@ class GpxReader { final elm = iterator.current; if (elm is XmlStartElementEvent) { - link.href = elm.attributes - .firstWhere((attr) => attr.name == GpxTagV11.href) - .value; + final hrefs = elm.attributes.where((attr) => attr.name == GpxTagV11.href); + + if (hrefs.isNotEmpty) { + link.href = hrefs.first.value; + } } if ((elm is XmlStartElementEvent) && !elm.isSelfClosing) {