Skip to content

Commit

Permalink
fix swift crash in ZXMultiFormatWriter.m
Browse files Browse the repository at this point in the history
  • Loading branch information
marioradonic committed Mar 20, 2019
1 parent ca04898 commit 6324769
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ZXingObjC/ZXMultiFormatWriter.m
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,15 @@ - (ZXBitMatrix *)encode:(NSString *)contents format:(ZXBarcodeFormat)format widt
if (error) *error = [NSError errorWithDomain:ZXErrorDomain code:ZXWriterError userInfo:@{NSLocalizedDescriptionKey: @"No encoder available for format"}];
return nil;
}
return [writer encode:contents format:format width:width height:height hints:hints error:error];

@try {
return [writer encode:contents format:format width:width height:height hints:hints error:error];
} @catch (NSException *exception) {
if (error) {
*error = [NSError errorWithDomain:ZXErrorDomain code:ZXWriterError userInfo:@{NSLocalizedDescriptionKey: exception.reason}];
}
return nil;
}
}

@end

0 comments on commit 6324769

Please sign in to comment.