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

Unverified Commit 81ec57aa authored by cketti's avatar cketti Committed by GitHub
Browse files

Merge pull request #4795 from k9mail/fix_reading_attachment_crash

Avoid NullPointerException when reading attachment
parents e0b6ca20 a2287ce3
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -60,6 +60,13 @@ public class AttachmentContentLoader extends AsyncTaskLoader<Attachment> {

            SafeContentResolver safeContentResolver = SafeContentResolver.newInstance(context);
            InputStream in = safeContentResolver.openInputStream(sourceAttachment.uri);
            if (in == null) {
                Timber.w("Error opening attachment for reading: %s", sourceAttachment.uri);

                cachedResultAttachment = sourceAttachment.deriveWithLoadCancelled();
                return cachedResultAttachment;
            }

            try {
                FileOutputStream out = new FileOutputStream(file);
                try {