Skip to content

Commit

Permalink
Merge pull request #4 from olegcherr/crashFix
Browse files Browse the repository at this point in the history
Fix: Was crashing on some devices (NPE during queryIntentServices)
  • Loading branch information
PaulRashidi committed Mar 4, 2016
2 parents 4ee7eb8 + edaecd3 commit 07b085b
Showing 1 changed file with 3 additions and 1 deletion.
Expand Up @@ -22,6 +22,7 @@
import android.content.Intent;
import android.content.IntentSender.SendIntentException;
import android.content.ServiceConnection;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
Expand Down Expand Up @@ -285,7 +286,8 @@ public void onServiceConnected(ComponentName name, IBinder service) {

Intent serviceIntent = new Intent("com.android.vending.billing.InAppBillingService.BIND");
serviceIntent.setPackage("com.android.vending");
if (!mContext.getPackageManager().queryIntentServices(serviceIntent, 0).isEmpty()) {
List<ResolveInfo> intentServices = mContext.getPackageManager().queryIntentServices(serviceIntent, 0);
if (intentServices != null && !intentServices.isEmpty()) {
// service available to handle that Intent
mContext.bindService(serviceIntent, mServiceConn, Context.BIND_AUTO_CREATE);
}
Expand Down

0 comments on commit 07b085b

Please sign in to comment.