Skip to content

Commit

Permalink
Fix nullable-to-nonnull-conversion warnings (#38677)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #38677

Cleaning up some build warnings when Wnullable-to-nonnull-conversion is enabled.

Changelog: Fixes nullability warnings from `RCTConverstions.h`.

Reviewed By: christophpurrer

Differential Revision: D47886567

fbshipit-source-id: 71d33951f8565e58ba6c9414dc4a40debf94785d
  • Loading branch information
caodoan authored and facebook-github-bot committed Aug 1, 2023
1 parent ec96641 commit 2856bef
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/react-native/React/Fabric/RCTConversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ inline NSString *RCTNSStringFromString(
const std::string &string,
const NSStringEncoding &encoding = NSUTF8StringEncoding)
{
return [NSString stringWithCString:string.c_str() encoding:encoding];
return [NSString stringWithCString:string.c_str() encoding:encoding] ?: @"";
}

inline NSString *_Nullable RCTNSStringFromStringNilIfEmpty(
Expand Down Expand Up @@ -56,8 +56,8 @@ inline UIColor *_Nullable RCTUIColorFromSharedColor(facebook::react::SharedColor
return [UIColor colorWithRed:components.red green:components.green blue:components.blue alpha:components.alpha];
}

inline CF_RETURNS_RETAINED CGColorRef
RCTCreateCGColorRefFromSharedColor(const facebook::react::SharedColor &sharedColor)
inline CF_RETURNS_RETAINED CGColorRef _Nullable RCTCreateCGColorRefFromSharedColor(
const facebook::react::SharedColor &sharedColor)
{
return CGColorRetain(RCTUIColorFromSharedColor(sharedColor).CGColor);
}
Expand Down

0 comments on commit 2856bef

Please sign in to comment.