IOSAD-121 Use error checks. IOSAD-121
authorDirk Zimmermann <dz@pep.security>
Thu, 25 Jul 2019 10:47:04 +0200
branchIOSAD-121
changeset 1106fb23fbc7b4d6
parent 1105 d17cf18af014
child 1107 4283084b59e2
IOSAD-121 Use error checks.
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 @@ -41,6 +41,7 @@
     1.4                                      error:(NSError * _Nullable * _Nullable)error
     1.5  {
     1.6      PEPInternalSession *session = [PEPSessionProvider session];
     1.7 +    RETURN_NIL_ON_ERROR(session, error);
     1.8      return [session
     1.9              decryptMessageDict:messageDict
    1.10              flags:flags
    1.11 @@ -58,6 +59,7 @@
    1.12                                     error:(NSError * _Nullable * _Nullable)error
    1.13  {
    1.14      PEPInternalSession *session = [PEPSessionProvider session];
    1.15 +    RETURN_NIL_ON_ERROR(session, error);
    1.16      return [session
    1.17              decryptMessage:message
    1.18              flags:flags
    1.19 @@ -102,6 +104,7 @@
    1.20                                      error:(NSError * _Nullable * _Nullable)error
    1.21  {
    1.22      PEPInternalSession *session = [PEPSessionProvider session];
    1.23 +    RETURN_NIL_ON_ERROR(session, error);
    1.24      return [session
    1.25              encryptMessageDict:messageDict
    1.26              extraKeys:extraKeys
    1.27 @@ -117,6 +120,7 @@
    1.28                                     error:(NSError * _Nullable * _Nullable)error
    1.29  {
    1.30      PEPInternalSession *session = [PEPSessionProvider session];
    1.31 +    RETURN_NIL_ON_ERROR(session, error);
    1.32      return [session
    1.33              encryptMessage:message
    1.34              extraKeys:extraKeys
    1.35 @@ -131,6 +135,7 @@
    1.36                                     error:(NSError * _Nullable * _Nullable)error
    1.37  {
    1.38      PEPInternalSession *session = [PEPSessionProvider session];
    1.39 +    RETURN_NIL_ON_ERROR(session, error);
    1.40      return [session encryptMessage:message extraKeys:extraKeys status:status error:error];
    1.41  }
    1.42  
    1.43 @@ -141,6 +146,7 @@
    1.44                                      error:(NSError * _Nullable * _Nullable)error
    1.45  {
    1.46      PEPInternalSession *session = [PEPSessionProvider session];
    1.47 +    RETURN_NIL_ON_ERROR(session, error);
    1.48      return [session
    1.49              encryptMessageDict:messageDict
    1.50              forSelf:ownIdentity
    1.51 @@ -156,6 +162,7 @@
    1.52                                     error:(NSError * _Nullable * _Nullable)error
    1.53  {
    1.54      PEPInternalSession *session = [PEPSessionProvider session];
    1.55 +    RETURN_NIL_ON_ERROR(session, error);
    1.56      return [session
    1.57              encryptMessage:message
    1.58              forSelf:ownIdentity
    1.59 @@ -172,6 +179,7 @@
    1.60                                      error:(NSError * _Nullable * _Nullable)error __deprecated
    1.61  {
    1.62      PEPInternalSession *session = [PEPSessionProvider session];
    1.63 +    RETURN_NIL_ON_ERROR(session, error);
    1.64      return [session
    1.65              encryptMessageDict:messageDict
    1.66              toFpr:toFpr
    1.67 @@ -189,6 +197,7 @@
    1.68                                     error:(NSError * _Nullable * _Nullable)error
    1.69  {
    1.70      PEPInternalSession *session = [PEPSessionProvider session];
    1.71 +    RETURN_NIL_ON_ERROR(session, error);
    1.72      return [session
    1.73              encryptMessage:message
    1.74              toFpr:toFpr
    1.75 @@ -202,6 +211,7 @@
    1.76                                             error:(NSError * _Nullable * _Nullable)error
    1.77  {
    1.78      PEPInternalSession *session = [PEPSessionProvider session];
    1.79 +    RETURN_NIL_ON_ERROR(session, error);
    1.80      return [session outgoingRatingForMessage:theMessage error:error];
    1.81  }
    1.82  
    1.83 @@ -209,6 +219,7 @@
    1.84                                                    error:(NSError * _Nullable * _Nullable)error
    1.85  {
    1.86      PEPInternalSession *session = [PEPSessionProvider session];
    1.87 +    RETURN_NIL_ON_ERROR(session, error);
    1.88      return [session outgoingRatingPreviewForMessage:theMessage error:error];
    1.89  }
    1.90  
    1.91 @@ -216,6 +227,7 @@
    1.92                                      error:(NSError * _Nullable * _Nullable)error
    1.93  {
    1.94      PEPInternalSession *session = [PEPSessionProvider session];
    1.95 +    RETURN_NIL_ON_ERROR(session, error);
    1.96      return [session ratingForIdentity:identity error:error];
    1.97  }
    1.98  
    1.99 @@ -225,6 +237,7 @@
   1.100                                            error:(NSError * _Nullable * _Nullable)error
   1.101  {
   1.102      PEPInternalSession *session = [PEPSessionProvider session];
   1.103 +    RETURN_NIL_ON_ERROR(session, error);
   1.104      return [session
   1.105              trustwordsForFingerprint:fingerprint
   1.106              languageID:languageID
   1.107 @@ -272,6 +285,7 @@
   1.108                             error:(NSError * _Nullable * _Nullable)error
   1.109  {
   1.110      PEPInternalSession *session = [PEPSessionProvider session];
   1.111 +    RETURN_NIL_ON_ERROR(session, error);
   1.112      return [session importKey:keydata error:error];
   1.113  }
   1.114  
   1.115 @@ -293,6 +307,7 @@
   1.116  - (NSString * _Nullable)getLogWithError:(NSError * _Nullable * _Nullable)error
   1.117  {
   1.118      PEPInternalSession *session = [PEPSessionProvider session];
   1.119 +    RETURN_NIL_ON_ERROR(session, error);
   1.120      return [session getLogWithError:error];
   1.121  }
   1.122  
   1.123 @@ -303,6 +318,7 @@
   1.124                                           error:(NSError * _Nullable * _Nullable)error
   1.125  {
   1.126      PEPInternalSession *session = [PEPSessionProvider session];
   1.127 +    RETURN_NIL_ON_ERROR(session, error);
   1.128      return [session getTrustwordsIdentity1:identity1
   1.129                                   identity2:identity2
   1.130                                    language:language
   1.131 @@ -317,12 +333,14 @@
   1.132                                      error:(NSError * _Nullable * _Nullable)error
   1.133  {
   1.134      PEPInternalSession *session = [PEPSessionProvider session];
   1.135 +    RETURN_NIL_ON_ERROR(session, error);
   1.136      return [session getTrustwordsFpr1:fpr1 fpr2:fpr2 language:language full:full error:error];
   1.137  }
   1.138  
   1.139  - (NSArray<PEPLanguage *> * _Nullable)languageListWithError:(NSError * _Nullable * _Nullable)error
   1.140  {
   1.141      PEPInternalSession *session = [PEPSessionProvider session];
   1.142 +    RETURN_NIL_ON_ERROR(session, error);
   1.143      return [session languageListWithError:error];
   1.144  }
   1.145  
   1.146 @@ -342,6 +360,7 @@
   1.147                              error:(NSError * _Nullable * _Nullable)error
   1.148  {
   1.149      PEPInternalSession *session = [PEPSessionProvider session];
   1.150 +    RETURN_NIL_ON_ERROR(session, error);
   1.151      return [session isPEPUser:identity error:error];
   1.152  }
   1.153