Merge "The fallback number of columns in the grid should be 1 instead of 0." into ub-launcher3-master
diff --git a/src/com/android/wallpaper/picker/LivePreviewFragment.java b/src/com/android/wallpaper/picker/LivePreviewFragment.java
index 451e3f7..74f7e79 100644
--- a/src/com/android/wallpaper/picker/LivePreviewFragment.java
+++ b/src/com/android/wallpaper/picker/LivePreviewFragment.java
@@ -339,11 +339,15 @@
                 new WallpaperConnection.WallpaperConnectionListener() {
                     @Override
                     public void onEngineShown() {
+                        Context context = getContext();
+                        if (context == null) {
+                            return;
+                        }
                         mLoadingScrim.post(() -> mLoadingScrim.animate()
                                 .alpha(0f)
                                 .setDuration(250)
                                 .setStartDelay(200)
-                                .setInterpolator(AnimationUtils.loadInterpolator(getActivity(),
+                                .setInterpolator(AnimationUtils.loadInterpolator(context,
                                         android.R.interpolator.fast_out_linear_in))
                                 .withEndAction(() -> {
                                     if (mLoadingProgressBar != null) {
@@ -360,7 +364,7 @@
                         previewView.animate()
                                 .setStartDelay(0)
                                 .setDuration(150)
-                                .setInterpolator(AnimationUtils.loadInterpolator(getContext(),
+                                .setInterpolator(AnimationUtils.loadInterpolator(context,
                                         android.R.interpolator.fast_out_linear_in))
                                 .setUpdateListener(value -> placeholder.setAlpha(
                                         (int) (255 * (1 - value.getAnimatedFraction()))))