diff --git a/src/Plugin.InAppBilling.Android/InAppBillingImplementation.cs b/src/Plugin.InAppBilling.Android/InAppBillingImplementation.cs
index 935a842..e954199 100644
--- a/src/Plugin.InAppBilling.Android/InAppBillingImplementation.cs
+++ b/src/Plugin.InAppBilling.Android/InAppBillingImplementation.cs
@@ -73,7 +73,7 @@ public InAppBillingImplementation()
///
public async override Task> GetProductInfoAsync(ItemType itemType, params string[] productIds)
{
- if (serviceConnection.Service == null)
+ if (serviceConnection?.Service == null)
{
throw new InAppBillingPurchaseException(PurchaseError.BillingUnavailable, "You are not connected to the Google Play App store.");
}
@@ -143,7 +143,7 @@ Task> GetProductInfoAsync(string[] productIds, string itemT
/// The current purchases
public async override Task> GetPurchasesAsync(ItemType itemType, IInAppBillingVerifyPurchase verifyPurchase = null)
{
- if (serviceConnection.Service == null)
+ if (serviceConnection?.Service == null)
{
throw new InAppBillingPurchaseException(PurchaseError.BillingUnavailable, "You are not connected to the Google Play App store.");
}
@@ -244,7 +244,7 @@ public async override Task PurchaseAsync(string productId,
throw new ArgumentNullException(nameof(payload), "Payload can not be null");
- if (serviceConnection.Service == null)
+ if (serviceConnection?.Service == null)
{
throw new InAppBillingPurchaseException(PurchaseError.BillingUnavailable, "You are not connected to the Google Play App store.");
}
@@ -395,7 +395,7 @@ public async override Task DisconnectAsync()
/// If consumed successful
public override Task ConsumePurchaseAsync(string productId, string purchaseToken)
{
- if (serviceConnection.Service == null)
+ if (serviceConnection?.Service == null)
{
throw new InAppBillingPurchaseException(PurchaseError.BillingUnavailable, "You are not connected to the Google Play App store.");
}
@@ -459,7 +459,7 @@ bool ParseConsumeResult(int response)
/// If consumed successful
public async override Task ConsumePurchaseAsync(string productId, ItemType itemType, string payload, IInAppBillingVerifyPurchase verifyPurchase)
{
- if (serviceConnection.Service == null)
+ if (serviceConnection?.Service == null)
throw new InAppBillingPurchaseException(PurchaseError.BillingUnavailable, "You are not connected to the Google Play App store.");