Fix ACTION_OPEN_DOCUMENT_TREE crash when no file picker available.

Fixes #10131
This commit is contained in:
Alex Hart 2021-01-05 13:10:42 -04:00 committed by Alan Evans
parent c466dba8c4
commit ce3872ce1a
2 changed files with 8 additions and 1 deletions

View file

@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.backup; package org.thoughtcrime.securesms.backup;
import android.content.ActivityNotFoundException;
import android.content.ClipData; import android.content.ClipData;
import android.content.ClipboardManager; import android.content.ClipboardManager;
import android.content.Context; import android.content.Context;
@ -126,7 +127,12 @@ public class BackupDialog {
Intent.FLAG_GRANT_WRITE_URI_PERMISSION | Intent.FLAG_GRANT_WRITE_URI_PERMISSION |
Intent.FLAG_GRANT_READ_URI_PERMISSION); Intent.FLAG_GRANT_READ_URI_PERMISSION);
fragment.startActivityForResult(intent, requestCode); try {
fragment.startActivityForResult(intent, requestCode);
} catch (ActivityNotFoundException e) {
Toast.makeText(fragment.requireContext(), R.string.BackupDialog_no_file_picker_available, Toast.LENGTH_LONG)
.show();
}
dialog.dismiss(); dialog.dismiss();
})) }))

View file

@ -2815,6 +2815,7 @@
<string name="BackupDialog_to_enable_backups_choose_a_folder">To enable backups, choose a folder. Backups will be saved to this location.</string> <string name="BackupDialog_to_enable_backups_choose_a_folder">To enable backups, choose a folder. Backups will be saved to this location.</string>
<string name="BackupDialog_choose_folder">Choose folder</string> <string name="BackupDialog_choose_folder">Choose folder</string>
<string name="BackupDialog_copied_to_clipboard">Copied to clipboard</string> <string name="BackupDialog_copied_to_clipboard">Copied to clipboard</string>
<string name="BackupDialog_no_file_picker_available">No file picker available.</string>
<string name="BackupDialog_enter_backup_passphrase_to_verify">Enter your backup passphrase to verify</string> <string name="BackupDialog_enter_backup_passphrase_to_verify">Enter your backup passphrase to verify</string>
<string name="BackupDialog_verify">Verify</string> <string name="BackupDialog_verify">Verify</string>
<string name="BackupDialog_you_successfully_entered_your_backup_passphrase">You successfully entered your backup passphrase</string> <string name="BackupDialog_you_successfully_entered_your_backup_passphrase">You successfully entered your backup passphrase</string>