Prevent NPE when init device profile
Fix: 198871283
Test: manual
Change-Id: Ie303ff4f3dc05f419e80038e41e195dc874ba40a
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 94dbe00..bb6e1cb 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -600,9 +600,11 @@
private void initDeviceProfile(InvariantDeviceProfile idp) {
// Load configuration-specific DeviceProfile
- mDeviceProfile = isInMultiWindowMode()
- ? mDeviceProfile.getMultiWindowProfile(this, getMultiWindowDisplaySize())
- : idp.getDeviceProfile(this);
+ mDeviceProfile = idp.getDeviceProfile(this);
+ if (isInMultiWindowMode()) {
+ mDeviceProfile = mDeviceProfile.getMultiWindowProfile(
+ this, getMultiWindowDisplaySize());
+ }
onDeviceProfileInitiated();
mModelWriter = mModel.getWriter(getDeviceProfile().isVerticalBarLayout(), true, this);