Skip to content

Commit c258b9a

Browse files
committed
🐛 Fix breaking on empty result
1 parent 9182b8d commit c258b9a

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Sources/Plan.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ struct Next: ParsableCommand {
179179
var next: [Event]
180180
if events.count == 0 {
181181
next = Array()
182+
} else {
183+
// prefix crashes if sequence has no elements
184+
next = Array(events.prefix(upTo: 1))
182185
}
183186

184-
// prefix crashes if sequence has no elements
185-
next = Array(events.prefix(upTo: 1))
186-
187187
switch format {
188188
case .json:
189189
next.printAsJson()

0 commit comments

Comments
 (0)