Skip to content

Commit 14234b4

Browse files
andrewjl-muxcjpillsbury
authored andcommitted
Remove force unwrap that can cause a crash (#47)
1 parent 30e9784 commit 14234b4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Sources/MuxUploadSDK/Upload/ChunkWorker.swift

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,15 @@ class ChunkWorker {
3434
}
3535

3636
func getTask() -> Task<Success, Error> {
37-
if uploadTask == nil {
37+
38+
guard let uploadTask else {
3839
chunkStartTime = Date().timeIntervalSince1970
39-
uploadTask = makeUploadTask()
40+
let uploadTask = makeUploadTask()
41+
self.uploadTask = uploadTask
42+
return uploadTask
4043
}
41-
return uploadTask!
44+
45+
return uploadTask
4246
}
4347

4448
func cancel() {

0 commit comments

Comments
 (0)