Merge pull request #4636 from k9mail/fix_startactivity_crash

Don't crash when selecting the destination for saving an attachment
This commit is contained in:
cketti 2020-04-04 22:10:47 +02:00 committed by GitHub
commit 3f60e41155
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,6 +6,7 @@ import java.util.Locale;
import android.app.Activity;
import android.app.DownloadManager;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
import android.content.IntentSender;
@ -822,7 +823,11 @@ public class MessageViewFragment extends Fragment implements ConfirmationDialogF
intent.putExtra(Intent.EXTRA_TITLE, attachment.displayName);
intent.addCategory(Intent.CATEGORY_OPENABLE);
startActivityForResult(intent, REQUEST_CODE_CREATE_DOCUMENT);
try {
startActivityForResult(intent, REQUEST_CODE_CREATE_DOCUMENT);
} catch (ActivityNotFoundException e) {
Toast.makeText(requireContext(), R.string.error_activity_not_found, Toast.LENGTH_LONG).show();
}
}
private AttachmentController getAttachmentController(AttachmentViewInfo attachment) {