From f7fe106d8984996c6906d47685febc87ac5709a8 Mon Sep 17 00:00:00 2001 From: Ben John Date: Tue, 4 Dec 2018 14:29:53 +0100 Subject: [PATCH] Also handle negative values cf #272. --- ZXingObjC/common/ZXHybridBinarizer.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ZXingObjC/common/ZXHybridBinarizer.m b/ZXingObjC/common/ZXHybridBinarizer.m index fe5c9c999..fe9ec3c9a 100644 --- a/ZXingObjC/common/ZXHybridBinarizer.m +++ b/ZXingObjC/common/ZXHybridBinarizer.m @@ -47,8 +47,8 @@ - (ZXBitMatrix *)blackMatrixWithError:(NSError **)error { ZXLuminanceSource *source = [self luminanceSource]; int width = source.width; int height = source.height; - if (width == 0 || height == 0) { - NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"Source is empty"}; + if (width <= 0 || height <= 0) { + NSDictionary *userInfo = @{NSLocalizedDescriptionKey: @"Source is empty or misbehaving."}; if (error) *error = [[NSError alloc] initWithDomain:ZXErrorDomain code:ZXNotFoundError userInfo:userInfo]; return nil; }