Fix nullable-to-nonnull-conversion warnings (#38677)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/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
This commit is contained in:
Cao Doan
2023-07-31 18:54:47 -07:00
committed by Facebook GitHub Bot
parent ec96641a17
commit 2856bef721
@@ -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(
@@ -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);
}