未验证 提交 269bab73 编写于 作者: C Chris Bracken 提交者: GitHub

Add nil check for country code and language code (#4732)

NSLocale objectForKey: may return nil for NSLocaleLanguageCode and
NSLocateCountryCode in certain cases.

This adds a defensive nil check for such cases.
上级 a4b1fccd
......@@ -724,7 +724,8 @@ static inline blink::PointerData::DeviceKind DeviceKindFromTouchType(UITouch* to
NSLocale* currentLocale = [NSLocale currentLocale];
NSString* languageCode = [currentLocale objectForKey:NSLocaleLanguageCode];
NSString* countryCode = [currentLocale objectForKey:NSLocaleCountryCode];
[_localizationChannel.get() invokeMethod:@"setLocale" arguments:@[ languageCode, countryCode ]];
if (languageCode && countryCode)
[_localizationChannel.get() invokeMethod:@"setLocale" arguments:@[ languageCode, countryCode ]];
}
#pragma mark - Set user settings
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册