core: Fixing configuration controller crash
12-24 16:23:32.690 17585 17585 E AndroidRuntime: java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Configuration android.content.res.Resources.getConfiguration()' on a null object reference 12-24 16:23:32.690 17585 17585 E AndroidRuntime: at android.app.ConfigurationController.updateLocaleListFromAppContext(ConfigurationController.java:285) 12-24 16:23:32.690 17585 17585 E AndroidRuntime: at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7775) 12-24 16:23:32.690 17585 17585 E AndroidRuntime: at android.app.ActivityThread.-$$Nest$mhandleBindApplication(Unknown Source:0) 12-24 16:23:32.690 17585 17585 E AndroidRuntime: at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2560) 12-24 16:23:32.690 17585 17585 E AndroidRuntime: at android.os.Handler.dispatchMessage(Handler.java:110) 12-24 16:23:32.690 17585 17585 E AndroidRuntime: at android.os.Looper.dispatchMessage(Looper.java:315) 12-24 16:23:32.690 17585 17585 E AndroidRuntime: at android.os.Looper.loopOnce(Looper.java:251) 12-24 16:23:32.690 17585 17585 E AndroidRuntime: at android.os.Looper.loop(Looper.java:349) 12-24 16:23:32.690 17585 17585 E AndroidRuntime: at android.app.ActivityThread.main(ActivityThread.java:9048) 12-24 16:23:32.690 17585 17585 E AndroidRuntime: at java.lang.reflect.Method.invoke(Native Method) 12-24 16:23:32.690 17585 17585 E AndroidRuntime: at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:593) 12-24 16:23:32.690 17585 17585 E AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:929) Change-Id: I96c139f477958fc29399e81b4892245606bcfe67 Signed-off-by: Ghosuto <clash.raja10@gmail.com>
This commit is contained in:
@@ -282,6 +282,10 @@ class ConfigurationController {
|
||||
* original LocaleList.
|
||||
*/
|
||||
void updateLocaleListFromAppContext(@NonNull Context context) {
|
||||
final Resources resources = context.getResources();
|
||||
if (resources == null) {
|
||||
return;
|
||||
}
|
||||
final Locale bestLocale = context.getResources().getConfiguration().getLocales().get(0);
|
||||
final LocaleList newLocaleList = mResourcesManager.getConfiguration().getLocales();
|
||||
final int newLocaleListSize = newLocaleList.size();
|
||||
|
||||
Reference in New Issue
Block a user