[Backup] Added null check for Restore backup uri

This commit is contained in:
Prathamesh More 2021-11-28 19:53:40 +05:30
parent eaa8cc3052
commit 0723c34ec4

View file

@ -48,7 +48,9 @@ class BackupFragment : Fragment(R.layout.fragment_backup), BackupAdapter.BackupC
backupViewModel.loadBackups()
val openFilePicker = registerForActivityResult(ActivityResultContracts.OpenDocument()) {
lifecycleScope.launch(Dispatchers.IO) {
backupViewModel.restoreBackup(requireActivity(), requireContext().contentResolver.openInputStream(it))
it?.let {
backupViewModel.restoreBackup(requireActivity(), requireContext().contentResolver.openInputStream(it))
}
}
}
binding.createBackup.setOnClickListener {