IOSAD-123 Explicitly check NSNumbers for nil to avoid problems. IOSAD-123
authorDirk Zimmermann <dz@pep.security>
Tue, 23 Jul 2019 15:03:28 +0200
branchIOSAD-123
changeset 108652ff9d05f7d9
parent 1085 8c9903acade8
child 1087 167f9d4b54aa
IOSAD-123 Explicitly check NSNumbers for nil to avoid problems.
pEpObjCAdapter/NSDictionary+CommType.m
pEpObjCAdapter/PEPInternalSession.m
     1.1 --- a/pEpObjCAdapter/NSDictionary+CommType.m	Tue Jul 23 14:08:42 2019 +0200
     1.2 +++ b/pEpObjCAdapter/NSDictionary+CommType.m	Tue Jul 23 15:03:28 2019 +0200
     1.3 @@ -19,7 +19,7 @@
     1.4  - (PEPCommType)commType
     1.5  {
     1.6      NSNumber *ctNum = self[kPepCommType];
     1.7 -    if (!ctNum) {
     1.8 +    if (ctNum == nil) {
     1.9          return PEPCommTypeUnknown;
    1.10      }
    1.11      return ctNum.intValue;
     2.1 --- a/pEpObjCAdapter/PEPInternalSession.m	Tue Jul 23 14:08:42 2019 +0200
     2.2 +++ b/pEpObjCAdapter/PEPInternalSession.m	Tue Jul 23 15:03:28 2019 +0200
     2.3 @@ -839,7 +839,7 @@
     2.4  - (PEPRating)ratingFromString:(NSString * _Nonnull)string
     2.5  {
     2.6      NSNumber *num = [stringToRating objectForKey:string];
     2.7 -    if (num) {
     2.8 +    if (num != nil) {
     2.9          return (PEPRating) [num integerValue];
    2.10      } else {
    2.11          return PEPRatingUndefined;