adding fallback locale for when the configuration locale is missing

This commit is contained in:
Adam Brown 2022-06-07 10:37:18 +01:00
parent 524dcbb3d1
commit 4ffce89ef2

View file

@ -26,7 +26,7 @@ import javax.inject.Inject
class LocaleProvider @Inject constructor(private val resources: Resources) {
fun current(): Locale {
return ConfigurationCompat.getLocales(resources.configuration)[0]
return ConfigurationCompat.getLocales(resources.configuration).get(0) ?: Locale.getDefault()
}
}