Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit 1de1f545 authored by cketti's avatar cketti Committed by GitHub
Browse files

Merge pull request #6255 from thundernest/fix_shared_attachment_crash

Don't crash when trying to access attachment (meta) data
parents 9cf73c99 fd396b18
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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!");
        }

+55 −48
Original line number Diff line number Diff line
@@ -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;
        }
    }
}