diff --git a/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.h b/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.h index 017fd0efd..09e6f3f2a 100644 --- a/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.h +++ b/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.h @@ -107,7 +107,6 @@ typedef void (^OWSThumbnailFailure)(void); // Marks attachment as having completed "lazy backup restore." - (void)updateWithLazyRestoreComplete; -// TODO: Review. - (nullable TSAttachmentStream *)cloneAsThumbnail; #pragma mark - Protobuf diff --git a/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m b/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m index fbeb56a97..83009a87a 100644 --- a/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m +++ b/SignalServiceKit/src/Messages/Attachments/TSAttachmentStream.m @@ -734,15 +734,17 @@ typedef void (^OWSLoadedThumbnailSuccess)(OWSLoadedThumbnail *loadedThumbnail); NSMutableArray *result = [NSMutableArray new]; NSString *thumbnailsDirPath = self.thumbnailsDirPath; - NSError *error; - NSArray *_Nullable fileNames = - [[NSFileManager defaultManager] contentsOfDirectoryAtPath:thumbnailsDirPath error:&error]; - if (error || !fileNames) { - OWSFail(@"contentsOfDirectoryAtPath failed with error: %@", error); - } else { - for (NSString *fileName in fileNames) { - NSString *filePath = [thumbnailsDirPath stringByAppendingPathComponent:fileName]; - [result addObject:filePath]; + if ([[NSFileManager defaultManager] fileExistsAtPath:thumbnailsDirPath]) { + NSError *error; + NSArray *_Nullable fileNames = + [[NSFileManager defaultManager] contentsOfDirectoryAtPath:thumbnailsDirPath error:&error]; + if (error || !fileNames) { + OWSFail(@"contentsOfDirectoryAtPath failed with error: %@", error); + } else { + for (NSString *fileName in fileNames) { + NSString *filePath = [thumbnailsDirPath stringByAppendingPathComponent:fileName]; + [result addObject:filePath]; + } } }