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>
This commit is contained in:
parent
b734f44200
commit
a113770868
@ -62,7 +62,7 @@ class TunnelListFragment : BaseFragment() {
|
|||||||
TunnelImporter.importTunnel(parentFragmentManager, result.text) { showSnackbar(it) }
|
TunnelImporter.importTunnel(parentFragmentManager, result.text) { showSnackbar(it) }
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
val error = ErrorMessages[e]
|
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)
|
Log.e(TAG, message, e)
|
||||||
showSnackbar(message)
|
showSnackbar(message)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user