Skip to content

Commit 3e9ddd8

Browse files
committed
ui: never throw on link clicks
Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 9e33d9e commit 3e9ddd8

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

ui/src/main/java/com/wireguard/android/preference/DonatePreference.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
package com.wireguard.android.preference
77

88
import android.app.AlertDialog
9-
import android.content.ActivityNotFoundException
109
import android.content.Context
1110
import android.content.Intent
1211
import android.net.Uri
1312
import android.util.AttributeSet
13+
import android.widget.Toast
1414
import androidx.preference.Preference
1515
import com.wireguard.android.BuildConfig
1616
import com.wireguard.android.R
@@ -32,7 +32,8 @@ class DonatePreference(context: Context, attrs: AttributeSet?) : Preference(cont
3232
intent.data = Uri.parse("https://www.wireguard.com/donations/")
3333
try {
3434
context.startActivity(intent)
35-
} catch (ignored: ActivityNotFoundException) {
35+
} catch (e: Throwable) {
36+
Toast.makeText(context, e.localizedMessage, Toast.LENGTH_SHORT).show()
3637
}
3738
}
3839
}

ui/src/main/java/com/wireguard/android/preference/VersionPreference.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@
44
*/
55
package com.wireguard.android.preference
66

7-
import android.content.ActivityNotFoundException
87
import android.content.Context
98
import android.content.Intent
109
import android.net.Uri
1110
import android.util.AttributeSet
11+
import android.widget.Toast
1212
import androidx.preference.Preference
1313
import com.wireguard.android.Application
1414
import com.wireguard.android.BuildConfig
@@ -33,7 +33,8 @@ class VersionPreference(context: Context, attrs: AttributeSet?) : Preference(con
3333
intent.data = Uri.parse("https://www.wireguard.com/")
3434
try {
3535
context.startActivity(intent)
36-
} catch (_: ActivityNotFoundException) {
36+
} catch (e: Throwable) {
37+
Toast.makeText(context, e.localizedMessage, Toast.LENGTH_SHORT).show()
3738
}
3839
}
3940

0 commit comments

Comments
 (0)