CR: fixup nil/error handling

This commit is contained in:
Michael Kirk 2019-08-15 11:03:35 -06:00
parent 546dbb13c4
commit e490163896
3 changed files with 5 additions and 5 deletions

View File

@ -2837,7 +2837,7 @@ typedef enum : NSUInteger {
_Nullable id<DataSource> dataSource = [DataSourcePath dataSourceWithURL:url
shouldDeleteOnDeallocation:NO
error:&error];
if (error != nil) {
if (dataSource == nil) {
OWSFailDebug(@"error: %@", error);
dispatch_async(dispatch_get_main_queue(), ^{

View File

@ -442,7 +442,7 @@ NS_ASSUME_NONNULL_BEGIN
_Nullable id<DataSource> 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> 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];

View File

@ -240,7 +240,7 @@ NS_ASSUME_NONNULL_BEGIN
_Nullable id<DataSource> 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> dataSource = [DataSourcePath dataSourceWithFilePath:filePath
shouldDeleteOnDeallocation:YES
error:&error];
if (error != nil) {
if (dataSource == nil) {
OWSFailDebug(@"Could not create dataSource: %@.", error);
return;
}