summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJay Freeman (saurik) <saurik@saurik.com>2014-05-25 03:52:34 -0700
committerJay Freeman (saurik) <saurik@saurik.com>2014-05-25 03:52:34 -0700
commit5af08e16fe0433b9618892fa5a13b0992555ba3e (patch)
tree559e9f94145ae4ffa1c3c9e736cdc6b8462b6d8f
parent89821e074f40e8c84b43018bb01fa6b74110ba30 (diff)
Avoid division by 0 and implicit-zero struct value.
-rw-r--r--MobileCydia.mm3
1 files changed, 3 insertions, 0 deletions
diff --git a/MobileCydia.mm b/MobileCydia.mm
index 41c52a9..df0c131 100644
--- a/MobileCydia.mm
+++ b/MobileCydia.mm
@@ -3153,6 +3153,7 @@ struct PackageNameOrdering :
string = [self name];
length = [string length];
+ if (length != 0)
for (NSString *term in query) {
range = [string rangeOfString:term options:MatchCompareOptions_];
if (range.location != NSNotFound)
@@ -3163,6 +3164,7 @@ struct PackageNameOrdering :
string = [self id];
length = [string length];
+ if (length != 0)
for (NSString *term in query) {
range = [string rangeOfString:term options:MatchCompareOptions_];
if (range.location != NSNotFound)
@@ -3174,6 +3176,7 @@ struct PackageNameOrdering :
length = [string length];
NSUInteger stop(std::min<NSUInteger>(length, 200));
+ if (length != 0)
for (NSString *term in query) {
range = [string rangeOfString:term options:MatchCompareOptions_ range:NSMakeRange(0, stop)];
if (range.location != NSNotFound)