Fix attachment description observation trying to access properties of deleted object

This commit is contained in:
Shadowfacts 2023-04-22 22:05:13 -04:00
parent 2249e5a315
commit 40197e04cf
1 changed files with 4 additions and 1 deletions

View File

@ -23,7 +23,10 @@ class AttachmentRowController: ViewController {
self.attachment = attachment
descriptionObservation = attachment.observe(\.attachmentDescription, changeHandler: { [unowned self] _, _ in
self.updateAttachmentDescriptionState()
// the faultingState is non-zero for objects that are being cascade deleted when the draft is deleted
if attachment.faultingState == 0 {
self.updateAttachmentDescriptionState()
}
})
}