Add error handling for onConfigurationChanged
The new config may comes before mApplication is assigned. Add the error handling to prevent the crash. Bug: 211031909 Test: Launch app without crash Change-Id: Iba5d1be0e6cb182b5f503f5aa827eb2967834d52
This commit is contained in:
@@ -1537,7 +1537,10 @@ public class Activity extends ContextThemeWrapper
|
||||
}
|
||||
|
||||
private void dispatchActivityConfigurationChanged() {
|
||||
getApplication().dispatchActivityConfigurationChanged(this);
|
||||
// In case the new config comes before mApplication is assigned.
|
||||
if (getApplication() != null) {
|
||||
getApplication().dispatchActivityConfigurationChanged(this);
|
||||
}
|
||||
Object[] callbacks = collectActivityLifecycleCallbacks();
|
||||
if (callbacks != null) {
|
||||
for (int i = 0; i < callbacks.length; i++) {
|
||||
|
||||
Reference in New Issue
Block a user