Skip to content

Commit 2556c03

Browse files
authored
Fix bug of "/" crashing
Fixes https://bugs.swift.org/browse/SR-7526. Tested on Linux 16.04 under Debug configuration.
1 parent 8278e03 commit 2556c03

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Foundation/NSPathUtilities.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -317,7 +317,7 @@ public extension NSString {
317317
}
318318

319319
// TODO: pathComponents keeps final path separator if any. Check that logic.
320-
if components.last == "/" {
320+
if components.last == "/" && components.count > 1 {
321321
components.removeLast()
322322
}
323323

0 commit comments

Comments
 (0)