Skip to content

Commit

Permalink
Check for null serviceConnection #80
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesmontemagno committed Oct 2, 2017
1 parent 3523a95 commit 4e79abc
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/Plugin.InAppBilling.Android/InAppBillingImplementation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public InAppBillingImplementation()
/// <returns></returns>
public async override Task<IEnumerable<InAppBillingProduct>> 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.");
}
Expand Down Expand Up @@ -143,7 +143,7 @@ Task<IEnumerable<Product>> GetProductInfoAsync(string[] productIds, string itemT
/// <returns>The current purchases</returns>
public async override Task<IEnumerable<InAppBillingPurchase>> 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.");
}
Expand Down Expand Up @@ -244,7 +244,7 @@ public async override Task<InAppBillingPurchase> 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.");
}
Expand Down Expand Up @@ -395,7 +395,7 @@ public async override Task DisconnectAsync()
/// <returns>If consumed successful</returns>
public override Task<InAppBillingPurchase> 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.");
}
Expand Down Expand Up @@ -459,7 +459,7 @@ bool ParseConsumeResult(int response)
/// <returns>If consumed successful</returns>
public async override Task<InAppBillingPurchase> 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.");


Expand Down

0 comments on commit 4e79abc

Please sign in to comment.