2
0
mirror of https://github.com/fork-maintainers/iceraven-browser synced 2024-11-03 23:15:31 +00:00

Closes #15812: Check for a null context during onScanResult

This commit is contained in:
Grisha Kruglov 2020-10-09 14:56:26 -07:00 committed by Grisha Kruglov
parent d5bef99834
commit 2030580fc8

View File

@ -37,6 +37,15 @@ class PairFragment : Fragment(R.layout.fragment_pair), UserInteractionHandler {
requestPermissions(permissions, REQUEST_CODE_CAMERA_PERMISSIONS)
},
onScanResult = { pairingUrl ->
// By the time we get a scan result, we may not be attached to the context anymore.
// See https://github.com/mozilla-mobile/fenix/issues/15812
if (context == null) {
findNavController().popBackStack(
R.id.turnOnSyncFragment,
false
)
return@QrFeature
}
requireComponents.services.accountsAuthFeature.beginPairingAuthentication(
requireContext(),
pairingUrl
@ -53,7 +62,7 @@ class PairFragment : Fragment(R.layout.fragment_pair), UserInteractionHandler {
@Suppress("Deprecation")
vibrator.vibrate(VIBRATE_LENGTH)
}
findNavController(this@PairFragment).popBackStack(
findNavController().popBackStack(
R.id.turnOnSyncFragment,
false
)