Skip to content

Commit 2f84f51

Browse files
committed
Fix crash in universal builds
1 parent 8719811 commit 2f84f51

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Diff for: Sources/swift-bundler/Subcommands/Build.swift

+3-2
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,10 @@ extension Bundler {
8181
command += " --arch arm64 --arch x86_64"
8282
}
8383
let exitStatus = Shell.getExitStatus(command, packageDir, silent: false, lineHandler: { line in
84-
if shouldBuildUniversal && line.split(separator: ":")[0].last == "%" {
84+
let parts = line.split(separator: ":")
85+
if shouldBuildUniversal && !parts.isEmpty && parts[0].last == "%" {
8586
// The output style changes completely in universal builds for whatever reason :)
86-
if let percentage = Double(line.split(separator: ":")[0].dropLast()) {
87+
if let percentage = Double(parts[0].dropLast()) {
8788
updateProgress(line, 0.8 * (percentage / 100) + 0.1, shouldLog: false)
8889
}
8990
} else if line.starts(with: "[") {

0 commit comments

Comments
 (0)