Merge pull request #6255 from thundernest/fix_shared_attachment_crash
Don't crash when trying to access attachment (meta) data
This commit is contained in:
commit
1de1f54518
2 changed files with 52 additions and 46 deletions
|
@ -3,7 +3,6 @@ package com.fsck.k9.activity.loader;
|
|||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
import android.content.ContentResolver;
|
||||
|
@ -88,7 +87,7 @@ public class AttachmentContentLoader extends AsyncTaskLoader<Attachment> {
|
|||
|
||||
cachedResultAttachment = sourceAttachment.deriveWithLoadComplete(file.getAbsolutePath());
|
||||
return cachedResultAttachment;
|
||||
} catch (IOException e) {
|
||||
} catch (Exception e) {
|
||||
Timber.e(e, "Error saving attachment!");
|
||||
}
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ public class AttachmentInfoLoader extends AsyncTaskLoader<Attachment> {
|
|||
|
||||
@Override
|
||||
public Attachment loadInBackground() {
|
||||
try {
|
||||
Uri uri = sourceAttachment.uri;
|
||||
String contentType = sourceAttachment.contentType;
|
||||
|
||||
|
@ -104,5 +105,11 @@ public class AttachmentInfoLoader extends AsyncTaskLoader<Attachment> {
|
|||
|
||||
cachedResultAttachment = sourceAttachment.deriveWithMetadataLoaded(usableContentType, name, size);
|
||||
return cachedResultAttachment;
|
||||
} catch (Exception e) {
|
||||
Timber.e(e, "Error getting attachment meta data");
|
||||
|
||||
cachedResultAttachment = sourceAttachment.deriveWithLoadCancelled();
|
||||
return cachedResultAttachment;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue