Skip to content

Commit

Permalink
Merge pull request codinguser#342 from rivaldi8/bugfix-341-no-applica…
Browse files Browse the repository at this point in the history
…tion-selected-import

Fix crash if no application is selected to choose a file to import accounts.
  • Loading branch information
codinguser committed Jun 16, 2015
2 parents a2ce02d + 18a35b5 commit 7dbab98
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 7dbab98

Please sign in to comment.