From 9948170fe65a7e208e02bb378764cfe41d02a3b8 Mon Sep 17 00:00:00 2001 From: Ryan ZHAO Date: Wed, 5 Aug 2020 16:54:26 +1000 Subject: [PATCH] fix debug assertion failure crash --- Signal/src/ViewControllers/MediaGalleryViewController.swift | 6 ++++-- .../src/Messages/Attachments/TSAttachmentStream.m | 3 ++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/Signal/src/ViewControllers/MediaGalleryViewController.swift b/Signal/src/ViewControllers/MediaGalleryViewController.swift index b0ecda828..8005d2737 100644 --- a/Signal/src/ViewControllers/MediaGalleryViewController.swift +++ b/Signal/src/ViewControllers/MediaGalleryViewController.swift @@ -797,12 +797,14 @@ class MediaGallery: NSObject, MediaGalleryDataSource, MediaTileViewControllerDel func buildGalleryItem(attachment: TSAttachment, transaction: YapDatabaseReadTransaction) -> MediaGalleryItem? { guard let attachmentStream = attachment as? TSAttachmentStream else { - owsFailDebug("gallery doesn't yet support showing undownloaded attachments") + // Avoid crash on dev mode + // owsFailDebug("gallery doesn't yet support showing undownloaded attachments") return nil } guard let message = attachmentStream.fetchAlbumMessage(with: transaction) else { - owsFailDebug("message was unexpectedly nil") + // Avoid crash on dev mode + // owsFailDebug("message was unexpectedly nil") return nil } diff --git a/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m b/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m index 40e4b9d2f..44c96241c 100644 --- a/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m +++ b/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m @@ -502,7 +502,8 @@ typedef void (^OWSLoadedThumbnailSuccess)(OWSLoadedThumbnail *loadedThumbnail); - (CGSize)imageSize { - OWSAssertDebug(self.shouldHaveImageSize); + // Avoid crash in dev mode + // OWSAssertDebug(self.shouldHaveImageSize); @synchronized(self) {