Skip to content

Commit 6f1e2d2

Browse files
committed
Fix parsing empty tags list in std ref loc
1 parent 57870bb commit 6f1e2d2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

LocMapper/RefLoc Support/StdRefLoc/StdRefLocFile.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,13 @@ public class StdRefLocFile {
5959
/* If we have successfully parsed rows in the tags cell, the cell content is invalid as the tags be on a single line: the header. */
6060
throw error
6161
}
62+
let tags = tagsParser.fieldNames.filter{ !$0.isEmpty }
6263
/* If the parser failed parsing the header, the value of fieldNames will be left at its current value, which is an empty array.
6364
* So if we have an empty fieldNames, but a non-empty tagsStr, we got an error parsing the tags. */
64-
guard !tagsParser.fieldNames.isEmpty || tagsStr.isEmpty else {
65+
guard !tags.isEmpty || tagsStr.isEmpty else {
6566
throw error
6667
}
67-
taggedKey = TaggedString(value: keyStr, tags: tagsParser.fieldNames)
68+
taggedKey = TaggedString(value: keyStr, tags: tags)
6869
} else {
6970
taggedKey = TaggedString(string: keyStr)
7071
}

0 commit comments

Comments
 (0)