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

Commit c4d30d64 authored by Chuck Liao's avatar Chuck Liao
Browse files

Add a null protection for getContext() when updating preview in theme/grid fragment.

They call getContext() in a callback, so it's possible that getContext() is called after the fragment is finished.
At this moment, the getContext() will return null.

Bug: 157624922
Change-Id: Id18b721ccd32a82d1c1925128829fbcd00a45b88
parent 16d8cb98
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -212,6 +212,9 @@ public class GridFragment extends AppbarFragment {
        if (mGridOptionPreviewer != null) {
            mGridOptionPreviewer.release();
        }
        if (getContext() == null) {
            return;
        }
        mGridOptionPreviewer = new GridOptionPreviewer(
                getContext(), mGridManager, mGridPreviewContainer);
        mGridOptionPreviewer.setGridOption(mSelectedOption, mGridManager.usesSurfaceView());
+3 −0
Original line number Diff line number Diff line
@@ -177,6 +177,9 @@ public class ThemeFragment extends AppbarFragment {
    }

    private void updateThemePreviewColorPerWallpaper() {
        if (getContext() == null) {
            return;
        }
        if (mCurrentHomeWallpaper != null && mWallpaperImage.getMeasuredWidth() > 0
                && mWallpaperImage.getMeasuredHeight() > 0) {
            WallpaperColorsLoader.getWallpaperColors(