Prevent crash when copying corrupted image attachment. (#1287)

// FREEBIE
pull/1/head
Michael Kirk 9 years ago committed by GitHub
parent 06618c99b5
commit 3c2846274c

@ -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);
}

Loading…
Cancel
Save