From e4901638969ea3b06de4bc6652f51d07ff0ea3ad Mon Sep 17 00:00:00 2001 From: Michael Kirk Date: Thu, 15 Aug 2019 11:03:35 -0600 Subject: [PATCH] CR: fixup nil/error handling --- .../ConversationView/ConversationViewController.m | 2 +- Signal/src/ViewControllers/DebugUI/DebugUIMessages.m | 4 ++-- Signal/src/ViewControllers/DebugUI/DebugUIMisc.m | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m index fae285287e..2df546f0b3 100644 --- a/Signal/src/ViewControllers/ConversationView/ConversationViewController.m +++ b/Signal/src/ViewControllers/ConversationView/ConversationViewController.m @@ -2837,7 +2837,7 @@ typedef enum : NSUInteger { _Nullable id dataSource = [DataSourcePath dataSourceWithURL:url shouldDeleteOnDeallocation:NO error:&error]; - if (error != nil) { + if (dataSource == nil) { OWSFailDebug(@"error: %@", error); dispatch_async(dispatch_get_main_queue(), ^{ diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m index 5e55450b53..880d3dec57 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m +++ b/Signal/src/ViewControllers/DebugUI/DebugUIMessages.m @@ -442,7 +442,7 @@ NS_ASSUME_NONNULL_BEGIN _Nullable id dataSource = [DataSourcePath dataSourceWithFilePath:filePath shouldDeleteOnDeallocation:NO error:&error]; - if (error != nil) { + if (dataSource == nil) { OWSFailDebug(@"error while creating data source: %@", error); failure(); return; @@ -1767,7 +1767,7 @@ NS_ASSUME_NONNULL_BEGIN _Nullable id dataSource = [DataSourcePath dataSourceWithFilePath:filePath shouldDeleteOnDeallocation:NO error:&error]; - OWSAssertDebug(error == nil); + OWSAssertDebug(dataSource != nil); [dataSource setSourceFilename:filename]; SignalAttachment *attachment = [SignalAttachment attachmentWithDataSource:dataSource dataUTI:utiType imageQuality:TSImageQualityOriginal]; diff --git a/Signal/src/ViewControllers/DebugUI/DebugUIMisc.m b/Signal/src/ViewControllers/DebugUI/DebugUIMisc.m index 1183bc391d..0a10f5bf51 100644 --- a/Signal/src/ViewControllers/DebugUI/DebugUIMisc.m +++ b/Signal/src/ViewControllers/DebugUI/DebugUIMisc.m @@ -240,7 +240,7 @@ NS_ASSUME_NONNULL_BEGIN _Nullable id dataSource = [DataSourcePath dataSourceWithFilePath:filePath shouldDeleteOnDeallocation:YES error:&error]; - OWSAssertDebug(error == nil); + OWSAssertDebug(dataSource != nil); [dataSource setSourceFilename:fileName]; SignalAttachment *attachment = [SignalAttachment attachmentWithDataSource:dataSource dataUTI:utiType]; NSData *databasePassword = [OWSPrimaryStorage.sharedManager databasePassword]; @@ -279,7 +279,7 @@ NS_ASSUME_NONNULL_BEGIN _Nullable id dataSource = [DataSourcePath dataSourceWithFilePath:filePath shouldDeleteOnDeallocation:YES error:&error]; - if (error != nil) { + if (dataSource == nil) { OWSFailDebug(@"Could not create dataSource: %@.", error); return; }