IOSAD-93 returning nil values in case of ... nil values
authorDirk Zimmermann <dirk@pep-project.org>
Wed, 16 May 2018 16:18:00 +0200
changeset 614f1bf3f2761dc
parent 613 f33d0b187aea
child 615 52097b5d3b72
IOSAD-93 returning nil values in case of ... nil values
pEpObjCAdapter/PEPInternalSession.m
     1.1 --- a/pEpObjCAdapter/PEPInternalSession.m	Wed May 16 16:17:59 2018 +0200
     1.2 +++ b/pEpObjCAdapter/PEPInternalSession.m	Wed May 16 16:18:00 2018 +0200
     1.3 @@ -194,12 +194,12 @@
     1.4                           status:status
     1.5                           error:error];
     1.6  
     1.7 -    if (!destDict) {
     1.8 -        return nil;
     1.9 -    } else {
    1.10 +    if (destDict) {
    1.11          PEPMessage *msg = [PEPMessage new];
    1.12          [msg setValuesForKeysWithDictionary:destDict];
    1.13          return msg;
    1.14 +    } else {
    1.15 +        return nil;
    1.16      }
    1.17  }
    1.18  
    1.19 @@ -315,9 +315,13 @@
    1.20                                              encFormat:encFormat
    1.21                                                 status:status
    1.22                                                  error:error];
    1.23 -    PEPMessage *encrypted = [PEPMessage new];
    1.24 -    [encrypted setValuesForKeysWithDictionary:encryptedDict];
    1.25 -    return encrypted;
    1.26 +    if (encryptedDict) {
    1.27 +        PEPMessage *encrypted = [PEPMessage new];
    1.28 +        [encrypted setValuesForKeysWithDictionary:encryptedDict];
    1.29 +        return encrypted;
    1.30 +    } else {
    1.31 +        return nil;
    1.32 +    }
    1.33  }
    1.34  
    1.35  - (PEPMessage * _Nullable)encryptMessage:(PEPMessage * _Nonnull)message
    1.36 @@ -396,9 +400,13 @@
    1.37                         status:status
    1.38                         error:error];
    1.39  
    1.40 -    PEPMessage *encrypted = [PEPMessage new];
    1.41 -    [encrypted setValuesForKeysWithDictionary:target];
    1.42 -    return encrypted;
    1.43 +    if (target) {
    1.44 +        PEPMessage *encrypted = [PEPMessage new];
    1.45 +        [encrypted setValuesForKeysWithDictionary:target];
    1.46 +        return encrypted;
    1.47 +    } else {
    1.48 +        return nil;
    1.49 +    }
    1.50  }
    1.51  
    1.52  
    1.53 @@ -449,9 +457,13 @@
    1.54                         status:status
    1.55                         error:error];
    1.56  
    1.57 -    PEPMessage *encrypted = [PEPMessage new];
    1.58 -    [encrypted setValuesForKeysWithDictionary:target];
    1.59 -    return encrypted;
    1.60 +    if (target) {
    1.61 +        PEPMessage *encrypted = [PEPMessage new];
    1.62 +        [encrypted setValuesForKeysWithDictionary:target];
    1.63 +        return encrypted;
    1.64 +    } else {
    1.65 +        return nil;
    1.66 +    }
    1.67  }
    1.68  
    1.69  - (NSNumber * _Nullable)outgoingRatingForMessageDict:(PEPDict * _Nonnull)messageDict