Skip to content

Commit

Permalink
Fix crash if no application is selected to choose a file to import ac…
Browse files Browse the repository at this point in the history
…counts.

Fixes codinguser#341
  • Loading branch information
rivaldi8 committed Jun 15, 2015
1 parent a2ce02d commit 18a35b5
Showing 1 changed file with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -573,12 +573,14 @@ public void onClick(DialogInterface dialog, int which) {
public void onActivityResult(int requestCode, int resultCode, Intent data) {
switch (requestCode) {
case AccountsActivity.REQUEST_PICK_ACCOUNTS_FILE:
try {
InputStream accountInputStream = getContentResolver().openInputStream(data.getData());
new ImportAsyncTask(this).execute(accountInputStream);
} catch (FileNotFoundException e) {
Crashlytics.logException(e);
Toast.makeText(this, R.string.toast_error_importing_accounts, Toast.LENGTH_SHORT).show();
if (resultCode == Activity.RESULT_OK && data != null) {
try {
InputStream accountInputStream = getContentResolver().openInputStream(data.getData());
new ImportAsyncTask(this).execute(accountInputStream);
} catch (FileNotFoundException e) {
Crashlytics.logException(e);
Toast.makeText(this, R.string.toast_error_importing_accounts, Toast.LENGTH_SHORT).show();
}
}
break;
case PasscodePreferenceFragment.PASSCODE_REQUEST_CODE:
Expand Down

0 comments on commit 18a35b5

Please sign in to comment.