Skip to content

Commit 58a22e5

Browse files
authored
Fix crash
Don't let MetaCode crash if it's initialised with an empty array of elements
1 parent a955d8d commit 58a22e5

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Sources/Meta/PlainCode.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ extension MetaCode {
5656
}
5757

5858
public var swiftString: String {
59+
guard metaElements.isEmpty == false else { return String() }
5960
var string = metaElements
6061
.map { $0.swiftString }
6162
.indented(indentation)

0 commit comments

Comments
 (0)