diff --git a/Signal/src/Models/TSMessageAdapaters/TSPhotoAdapter.m b/Signal/src/Models/TSMessageAdapaters/TSPhotoAdapter.m index 5df6e5106..cd12927c3 100644 --- a/Signal/src/Models/TSMessageAdapaters/TSPhotoAdapter.m +++ b/Signal/src/Models/TSMessageAdapaters/TSPhotoAdapter.m @@ -85,6 +85,15 @@ - (void)performEditingAction:(SEL)action { + NSString *actionString = NSStringFromSelector(action); + if (!self.image) { + DDLogWarn(@"Refusing to perform '%@' action with nil image for %@: attachmentId=%@. (corrupted attachment?)", + actionString, + self.class, + self.attachmentId); + return; + } + if (action == @selector(copy:)) { UIPasteboard.generalPasteboard.image = self.image; return; @@ -94,7 +103,6 @@ } // Shouldn't get here, as only supported actions should be exposed via canPerformEditingAction - NSString *actionString = NSStringFromSelector(action); DDLogError(@"'%@' action unsupported for %@: attachmentId=%@", actionString, self.class, self.attachmentId); }