Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6aa5a44d authored by Diego Perez's avatar Diego Perez
Browse files

Fix isThemeAppCompat NPE when using an invalid theme

When the theme does not longer exists on the Android Studio side,
getDefaultTheme will return null causing isThemeAppCompat to crash.

Change-Id: I5a5c17126dce72e9872522643219b9438666bc04
parent 220f360e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1199,15 +1199,15 @@ public class RenderSessionImpl extends RenderAction<SessionParams> {
          // between Theme.AppCompat.Light and Theme.AppCompat is Theme.Material (for v21).
            boolean isThemeAppCompat = false;
            for (int i = 0; i < 50; i++) {
                if (defaultTheme == null) {
                    break;
                }
                // for loop ensures that we don't run into cyclic theme inheritance.
                if (defaultTheme.getName().startsWith("Theme.AppCompat")) {
                    isThemeAppCompat = true;
                    break;
                }
                defaultTheme = resources.getParent(defaultTheme);
                if (defaultTheme == null) {
                    break;
                }
            }
            mIsThemeAppCompat = isThemeAppCompat;
        }