TunnelEditorFragment: do not assume a context

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2020-09-20 18:08:58 +02:00
parent 655a853857
commit 5fd1a32ae4

View File

@ -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]