diff --git a/android/src/com/mapswithme/maps/MwmActivity.java b/android/src/com/mapswithme/maps/MwmActivity.java index 5f606ee0a1..f8939b18aa 100644 --- a/android/src/com/mapswithme/maps/MwmActivity.java +++ b/android/src/com/mapswithme/maps/MwmActivity.java @@ -236,9 +236,8 @@ public class MwmActivity extends BaseMwmFragmentActivity private Bundle mSavedForTabletState; @Nullable private PlacePageTracker mPlacePageTracker; - @NonNull - private PurchaseController mAdsRemovalPurchaseController = - PurchaseFactory.createPurchaseController(); + @Nullable + private PurchaseController mAdsRemovalPurchaseController; @NonNull private final OnClickListener mOnMyPositionClickListener = new CurrentPositionClickListener(); @@ -557,6 +556,7 @@ public class MwmActivity extends BaseMwmFragmentActivity SharingHelper.INSTANCE.initialize(); + mAdsRemovalPurchaseController = PurchaseFactory.createPurchaseController(); mAdsRemovalPurchaseController.initialize(this); //TODO: uncomment after correct visible rect calculation. @@ -1328,7 +1328,8 @@ public class MwmActivity extends BaseMwmFragmentActivity protected void onDestroy() { super.onDestroy(); - mAdsRemovalPurchaseController.destroy(); + if (mAdsRemovalPurchaseController != null) + mAdsRemovalPurchaseController.destroy(); } @Override