forked from shadowfacts/Tusker
Fix crash if draft attachment lacks data
This commit is contained in:
parent
0343e2e310
commit
70f8748364
|
@ -112,6 +112,9 @@ class AttachmentThumbnailController: ViewController {
|
|||
// }
|
||||
}
|
||||
}
|
||||
|
||||
case .none:
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public final class DraftAttachment: NSManagedObject, Identifiable {
|
|||
} else if let fileURL, let fileType {
|
||||
return .file(fileURL, UTType(fileType)!)
|
||||
} else {
|
||||
fatalError()
|
||||
return .none
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,7 @@ public final class DraftAttachment: NSManagedObject, Identifiable {
|
|||
case drawing(PKDrawing)
|
||||
case file(URL, UTType)
|
||||
case editing(String, Attachment.Kind, URL)
|
||||
case none
|
||||
}
|
||||
|
||||
public override func prepareForDeletion() {
|
||||
|
@ -246,6 +247,8 @@ extension DraftAttachment {
|
|||
completion(.success((fileData, type)))
|
||||
}
|
||||
}
|
||||
} else {
|
||||
completion(.failure(.noData))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -309,5 +312,6 @@ extension DraftAttachment {
|
|||
case noVideoExportSession
|
||||
case loadingDrawing
|
||||
case loadingData
|
||||
case noData
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue