From d8913ef63abbd250ed6ea281d26520c1908a6f6d Mon Sep 17 00:00:00 2001 From: Sylvain Berfini Date: Tue, 21 Jul 2015 15:29:30 +0200 Subject: [PATCH] Fix crash if purchase service not available --- src/org/linphone/purchase/InAppPurchaseHelper.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/org/linphone/purchase/InAppPurchaseHelper.java b/src/org/linphone/purchase/InAppPurchaseHelper.java index 7e1a7dcba..729aabb25 100644 --- a/src/org/linphone/purchase/InAppPurchaseHelper.java +++ b/src/org/linphone/purchase/InAppPurchaseHelper.java @@ -298,10 +298,12 @@ public class InAppPurchaseHelper { if (buyIntentBundle != null) { PendingIntent pendingIntent = buyIntentBundle.getParcelable(RESPONSE_BUY_INTENT); - try { - ((Activity) mContext).startIntentSenderForResult(pendingIntent.getIntentSender(), ACTIVITY_RESULT_CODE_PURCHASE_ITEM, new Intent(), 0, 0, 0); - } catch (SendIntentException e) { - Log.e(e); + if (pendingIntent != null) { + try { + ((Activity) mContext).startIntentSenderForResult(pendingIntent.getIntentSender(), ACTIVITY_RESULT_CODE_PURCHASE_ITEM, new Intent(), 0, 0, 0); + } catch (SendIntentException e) { + Log.e(e); + } } } }