Skip to content

Commit 8eaac64

Browse files
Fix IndexPath slicing crash
1 parent 3d1c1ad commit 8eaac64

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/Foundation/IndexPath.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,9 +261,9 @@ public struct IndexPath : ReferenceConvertible, Equatable, Hashable, MutableColl
261261
case 0:
262262
return .empty
263263
case 1:
264-
return .single(slice[0])
264+
return .single(slice.first!)
265265
case 2:
266-
return .pair(slice[0], slice[1])
266+
return .pair(slice.first!, slice.last!)
267267
default:
268268
return .array(Array<Int>(slice))
269269
}

0 commit comments

Comments
 (0)