diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2023-03-30 13:54:06 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2023-03-30 13:54:06 +0200 |
commit | a113770868871426f5663c2b96eee0015ca959d1 (patch) | |
tree | ea50e6b5f57951a176e4745e8e1ffb1f1c79e997 /ui/src/main | |
parent | b734f44200c40fb630fbc566dd245693145f93ec (diff) |
ui: use app resources instead of ctx for strings in callback
Exception java.lang.IllegalStateException:
at androidx.fragment.app.Fragment.requireContext (Fragment.java:967)
at com.wireguard.android.fragment.TunnelListFragment$tunnelFileImportResultLauncher$1$1.invokeSuspend (TunnelListFragment.kt:64)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith (ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run (DispatchedTask.kt:104)
at android.os.Handler.handleCallback (Handler.java:761)
at android.os.Handler.dispatchMessage (Handler.java:98)
at android.os.Looper.loop (Looper.java:156)
at android.app.ActivityThread.main (ActivityThread.java:6617)
at java.lang.reflect.Method.invoke
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run (ZygoteInit.java:942)
at com.android.internal.os.ZygoteInit.main (ZygoteInit.java:832)
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Diffstat (limited to 'ui/src/main')
-rw-r--r-- | ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt b/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt index 5f3d3950..e6270d0e 100644 --- a/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt +++ b/ui/src/main/java/com/wireguard/android/fragment/TunnelListFragment.kt @@ -62,7 +62,7 @@ class TunnelListFragment : BaseFragment() { TunnelImporter.importTunnel(parentFragmentManager, result.text) { showSnackbar(it) } } catch (e: Exception) { val error = ErrorMessages[e] - val message = requireContext().getString(R.string.import_error, error) + val message = Application.get().resources.getString(R.string.import_error, error) Log.e(TAG, message, e) showSnackbar(message) } |