You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While experimenting with Xcode 10 and the "Xcode 10.0" swift toolchain i encountered this.
It appears if i obtain a string by joining an empty array of strings, and then append it as a path-component on a URL, i get different results than when using a plain string.
I managed to create an example reproducing the issue:
importFoundationletemptyStringArray: [String] = []
letnonEmptyStringArray: [String] = [""]
leturl = URL(string: "http://example.org")
letfromEmptyStringArray: String = emptyStringArray.joined(separator: "/")let fromNonEmptyStringArray: String = nonEmptyStringArray.joined(separator: "/")let plainEmptyString = ""// this worksurl?.appendingPathComponent(plainEmptyString)url?.appendingPathComponent("")
// this will crash
url?.appendingPathComponent(fromEmptyStringArray)
// Precondition failed: Index out of bounds: file /BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-1000.0.16.7/src/swift/stdlib/public/core/StringStorage.swift, line 108
// this will crash:
url?.appendingPathComponent(fromNonEmptyStringArray)
// Precondition failed: Index out of bounds: file /BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-1000.0.16.7/src/swift/stdlib/public/core/StringStorage.swift, line 108
The text was updated successfully, but these errors were encountered:
Environment
Xcode Version: Version 10.0 beta (10L176w)
Swift Toolchain: Xcode 10.0
Additional Detail from JIRA
md5: 0997f8cab1e648649edd3509a06a4228
Issue Description:
While experimenting with Xcode 10 and the "Xcode 10.0" swift toolchain i encountered this.
It appears if i obtain a string by joining an empty array of strings, and then append it as a path-component on a URL, i get different results than when using a plain string.
I managed to create an example reproducing the issue:
The text was updated successfully, but these errors were encountered: