Skip to content

Commit 0ea0244

Browse files
authored
Fix analyze of FirebaseFunctions (#1742)
1 parent e0235c7 commit 0ea0244

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

Functions/FirebaseFunctions/FUNError.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ NS_ASSUME_NONNULL_BEGIN
2929
* @param serializer A serializer to use to decode the details in the error response.
3030
* @return The corresponding error.
3131
*/
32-
NSError *FUNErrorForResponse(NSInteger status, NSData *_Nullable body, FUNSerializer *serializer);
32+
NSError *_Nullable FUNErrorForResponse(NSInteger status,
33+
NSData *_Nullable body,
34+
FUNSerializer *serializer);
3335

3436
NS_ASSUME_NONNULL_END

Functions/FirebaseFunctions/FUNError.m

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ FIRFunctionsErrorCode FIRFunctionsErrorCodeForName(NSString *name) {
9090
};
9191
});
9292
NSNumber *code = errors[name];
93-
if (code) {
93+
if (code != nil) {
9494
return code.intValue;
9595
}
9696
return FIRFunctionsErrorCodeInternal;
@@ -141,7 +141,9 @@ FIRFunctionsErrorCode FIRFunctionsErrorCodeForName(NSString *name) {
141141
return @"UNKNOWN";
142142
}
143143

144-
NSError *FUNErrorForResponse(NSInteger status, NSData *_Nullable body, FUNSerializer *serializer) {
144+
NSError *_Nullable FUNErrorForResponse(NSInteger status,
145+
NSData *_Nullable body,
146+
FUNSerializer *serializer) {
145147
// Start with reasonable defaults from the status code.
146148
FIRFunctionsErrorCode code = FIRFunctionsErrorCodeForHTTPStatus(status);
147149
NSString *description = FUNDescriptionForErrorCode(code);

Functions/FirebaseFunctions/FUNSerializer.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ - (id)decodeWrappedType:(NSDictionary *)wrapped error:(NSError **)error {
152152
if ([type isEqualToString:kLongType]) {
153153
NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
154154
NSNumber *n = [formatter numberFromString:value];
155-
if (!n) {
155+
if (n == nil) {
156156
*error = FUNInvalidNumberError(value, wrapped);
157157
return nil;
158158
}

0 commit comments

Comments
 (0)