IOSAD-121 Handle (and document) corner cases. IOSAD-121
authorDirk Zimmermann <dz@pep.security>
Thu, 25 Jul 2019 10:47:04 +0200
branchIOSAD-121
changeset 11098de941d1c5c7
parent 1108 b61cf4d87e40
child 1110 d091bcef3ae4
IOSAD-121 Handle (and document) corner cases.
pEpObjCAdapter/PEPSession.m
pEpObjCAdapterFramework/PEPSessionProtocol.h
     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 @@ -355,12 +355,18 @@
     1.4  - (PEPRating)ratingFromString:(NSString * _Nonnull)string
     1.5  {
     1.6      PEPInternalSession *session = [PEPSessionProvider session];
     1.7 +    if (session == nil) {
     1.8 +        return PEPRatingUndefined;
     1.9 +    }
    1.10      return [session ratingFromString:string];
    1.11  }
    1.12  
    1.13  - (NSString * _Nonnull)stringFromRating:(PEPRating)rating
    1.14  {
    1.15      PEPInternalSession *session = [PEPSessionProvider session];
    1.16 +    if (session == nil) {
    1.17 +        return @"undefined";
    1.18 +    }
    1.19      return [session stringFromRating:rating];
    1.20  }
    1.21  
    1.22 @@ -415,6 +421,9 @@
    1.23  - (PEPColor)colorFromRating:(PEPRating)rating
    1.24  {
    1.25      PEPInternalSession *session = [PEPSessionProvider session];
    1.26 +    if (session == nil) {
    1.27 +        return PEP_color_no_color;
    1.28 +    }
    1.29      return [session colorFromRating:rating];
    1.30  }
    1.31  
     2.1 --- a/pEpObjCAdapterFramework/PEPSessionProtocol.h	Thu Jul 25 10:47:04 2019 +0200
     2.2 +++ b/pEpObjCAdapterFramework/PEPSessionProtocol.h	Thu Jul 25 10:47:04 2019 +0200
     2.3 @@ -242,6 +242,7 @@
     2.4  
     2.5  /**
     2.6   Wraps the engine's `config_passive_mode`.
     2.7 + @note That there's absolutely no error handling.
     2.8   */
     2.9  - (void)configurePassiveModeEnabled:(BOOL)enabled;
    2.10