Skip to content

Commit

Permalink
Merge pull request #44 from voynovia/hotfix/attributes
Browse files Browse the repository at this point in the history
fixed crash
  • Loading branch information
vincentneo committed Jul 20, 2019
2 parents 4dbc033 + cf9693d commit a63766c
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Classes/GPXExtensions.swift
Expand Up @@ -55,8 +55,9 @@ open class GPXExtensions: GPXElement, Codable {
}
// ignore any key that does not conform to GPXExtension's parsing naming convention.
}
if elementNames.isEmpty {
rootAttributes = attributes[0]
if !attributes.isEmpty, elementNames.isEmpty {
guard let first = attributes.first else { return }
rootAttributes = first
}
else {
for elementNameIndex in elementNames.keys {
Expand Down

0 comments on commit a63766c

Please sign in to comment.