Null check in locale resolution (#23301)

This commit is contained in:
Gary Qian 2018-10-19 14:18:09 -07:00 committed by GitHub
parent 48fe65c236
commit a46510598e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -678,6 +678,9 @@ class _WidgetsAppState extends State<WidgetsApp> implements WidgetsBindingObserv
Locale _locale;
Locale _resolveLocale(Locale newLocale, Iterable<Locale> supportedLocales) {
if (newLocale == null) {
return supportedLocales.first;
}
if (widget.localeResolutionCallback != null) {
final Locale locale = widget.localeResolutionCallback(newLocale, widget.supportedLocales);
if (locale != null)