android: VersionPreference: Handle no-browser-installed case

Signed-off-by: Harsh Shandilya <me@msfjarvis.dev>
This commit is contained in:
Harsh Shandilya 2018-06-30 20:45:42 +05:30 committed by Jason A. Donenfeld
parent 0e3e3ae37b
commit 5c9643a23b

View File

@ -5,6 +5,7 @@
package com.wireguard.android.preference; package com.wireguard.android.preference;
import android.content.ActivityNotFoundException;
import android.content.Context; import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.net.Uri; import android.net.Uri;
@ -46,7 +47,9 @@ public class VersionPreference extends Preference {
protected void onClick() { protected void onClick() {
final Intent intent = new Intent(Intent.ACTION_VIEW); final Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setData(Uri.parse("https://www.wireguard.com/")); intent.setData(Uri.parse("https://www.wireguard.com/"));
try {
getContext().startActivity(intent); getContext().startActivity(intent);
} catch (final ActivityNotFoundException ignored) { }
} }
} }