From 5fd1a32ae419cb064da91bd48391a1837ad969e9 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Sun, 20 Sep 2020 18:08:58 +0200 Subject: [PATCH] TunnelEditorFragment: do not assume a context Signed-off-by: Jason A. Donenfeld --- .../com/wireguard/android/fragment/TunnelEditorFragment.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt b/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt index 26349211..e035210a 100644 --- a/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt +++ b/ui/src/main/java/com/wireguard/android/fragment/TunnelEditorFragment.kt @@ -48,7 +48,7 @@ class TunnelEditorFragment : BaseFragment() { if (throwable == null) { message = getString(R.string.config_save_success, savedTunnel.name) Log.d(TAG, message) - Toast.makeText(requireContext(), message, Toast.LENGTH_SHORT).show() + Toast.makeText(activity ?: Application.get(), message, Toast.LENGTH_SHORT).show() onFinished() } else { val error = ErrorMessages[throwable] @@ -214,7 +214,7 @@ class TunnelEditorFragment : BaseFragment() { tunnel = newTunnel message = getString(R.string.tunnel_create_success, tunnel!!.name) Log.d(TAG, message) - Toast.makeText(requireContext(), message, Toast.LENGTH_SHORT).show() + Toast.makeText(activity ?: Application.get(), message, Toast.LENGTH_SHORT).show() onFinished() } else { val error = ErrorMessages[throwable]