Browse Source

IOSAD-127 Be explicit about NSNumber nil checks

IOSAD-127
Dirk Zimmermann 2 years ago
parent
commit
fbbb623e56
2 changed files with 5 additions and 5 deletions
  1. +1
    -1
      pEpObjCAdapter/PEPInternalSession.m
  2. +4
    -4
      pEpObjCAdapter/PEPSession.m

+ 1
- 1
pEpObjCAdapter/PEPInternalSession.m View File

@ -826,7 +826,7 @@ static NSDictionary *stringToRating;
- (PEPRating)ratingFromString:(NSString * _Nonnull)string
{
NSNumber *num = [stringToRating objectForKey:string];
if (num) {
if (num != nil) {
return (PEPRating) [num integerValue];
} else {
return PEPRatingUndefined;


+ 4
- 4
pEpObjCAdapter/PEPSession.m View File

@ -207,7 +207,7 @@ static dispatch_queue_t queue;
NSNumber *ratingNum = [[PEPSessionProvider session]
outgoingRatingForMessage:theMessage
error:&error];
if (ratingNum) {
if (ratingNum != nil) {
successCallback(ratingNum.pEpRating);
} else {
errorCallback(error);
@ -224,7 +224,7 @@ static dispatch_queue_t queue;
NSNumber *ratingNum = [[PEPSessionProvider session]
ratingForIdentity:identity
error:&error];
if (ratingNum) {
if (ratingNum != nil) {
successCallback(ratingNum.pEpRating);
} else {
errorCallback(error);
@ -371,7 +371,7 @@ successCallback:(void (^)(PEPIdentity *identity))successCallback
NSNumber *boolNum = [[PEPSessionProvider session]
queryKeySyncEnabledForIdentity:identity
error:&error];
if (boolNum) {
if (boolNum != nil) {
successCallback(boolNum.boolValue);
} else {
errorCallback(error);
@ -497,7 +497,7 @@ successCallback:(void (^)(NSString *log))successCallback
dispatch_async(queue, ^{
NSError *error = nil;
NSNumber *ispEpUserNum = [[PEPSessionProvider session] isPEPUser:identity error:&error];
if (ispEpUserNum) {
if (ispEpUserNum != nil) {
successCallback(ispEpUserNum.boolValue);
} else {
errorCallback(error);


Loading…
Cancel
Save