Fix crash if purchase service not available

This commit is contained in:
Sylvain Berfini 2015-07-21 15:29:30 +02:00
parent 82d804587a
commit d8913ef63a

View file

@ -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);
}
}
}
}