fix NPE crash if VPN prepare Intent is null on boot

This commit is contained in:
Nathan Freitas 2015-04-13 10:24:03 -04:00
parent ddecd0ce82
commit ec24428915
1 changed files with 8 additions and 8 deletions

View File

@ -33,15 +33,15 @@ public class OnBootReceiver extends BroadcastReceiver {
@SuppressLint("NewApi")
public void startVpnService (Context context)
{
Intent intent = VpnService.prepare(context);
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
{
Intent intent = VpnService.prepare(context);
if (intent != null) {
context.startActivity(intent);
}
if (intent != null) {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
}
}
private void startService (String action, Context context)
{