mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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:
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user