IOSAD-121 Macro for returning nil on session fail. IOSAD-121
authorDirk Zimmermann <dz@pep.security>
Thu, 25 Jul 2019 10:47:04 +0200
branchIOSAD-121
changeset 1105d17cf18af014
parent 1104 802191d6d984
child 1106 fb23fbc7b4d6
IOSAD-121 Macro for returning nil on session fail.
pEpObjCAdapter/PEPSession.m
     1.1 --- a/pEpObjCAdapter/PEPSession.m	Thu Jul 25 10:47:04 2019 +0200
     1.2 +++ b/pEpObjCAdapter/PEPSession.m	Thu Jul 25 10:47:04 2019 +0200
     1.3 @@ -14,9 +14,18 @@
     1.4  
     1.5  #import "PEPMessageUtil.h"
     1.6  #import "NSNumber+PEPRating.h"
     1.7 +#import "NSError+PEP+Internal.h"
     1.8  
     1.9  @implementation PEPSession
    1.10  
    1.11 +#define RETURN_NIL_ON_ERROR(session, error)\
    1.12 + if (session == nil) { \
    1.13 +   if (error != nil) { \
    1.14 +     *error = [NSError errorWithPEPStatusInternal:PEP_UNKNOWN_ERROR]; \
    1.15 +     return nil; \
    1.16 +   } \
    1.17 + }
    1.18 +
    1.19  #pragma mark - Public API
    1.20  
    1.21  + (void)cleanup