diff --git a/app/src/main/java/eu/faircode/email/ActivityEML.java b/app/src/main/java/eu/faircode/email/ActivityEML.java index 7eb7b756fb..31d85ec5e8 100644 --- a/app/src/main/java/eu/faircode/email/ActivityEML.java +++ b/app/src/main/java/eu/faircode/email/ActivityEML.java @@ -310,6 +310,8 @@ public class ActivityEML extends ActivityBase { InputStream is; try { pfd = getContentResolver().openFileDescriptor(uri, "w"); + if (pfd == null) + throw new FileNotFoundException(uri.toString()); os = new FileOutputStream(pfd.getFileDescriptor()); is = apart.part.getInputStream(); diff --git a/app/src/main/java/eu/faircode/email/FragmentBase.java b/app/src/main/java/eu/faircode/email/FragmentBase.java index cb95c0f5d5..5c84e2a8d2 100644 --- a/app/src/main/java/eu/faircode/email/FragmentBase.java +++ b/app/src/main/java/eu/faircode/email/FragmentBase.java @@ -360,6 +360,8 @@ public class FragmentBase extends Fragment { InputStream is = null; try { pfd = context.getContentResolver().openFileDescriptor(uri, "w"); + if (pfd == null) + throw new FileNotFoundException(uri.toString()); os = new FileOutputStream(pfd.getFileDescriptor()); is = new FileInputStream(file); @@ -448,6 +450,8 @@ public class FragmentBase extends Fragment { InputStream is = null; try { pfd = context.getContentResolver().openFileDescriptor(document.getUri(), "w"); + if (pfd == null) + throw new FileNotFoundException(name); os = new FileOutputStream(pfd.getFileDescriptor()); is = new FileInputStream(file); diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 14b205ea4e..c4d7523596 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -5134,6 +5134,8 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. InputStream is = null; try { pfd = context.getContentResolver().openFileDescriptor(uri, "w"); + if (pfd == null) + throw new FileNotFoundException(uri.toString()); os = new FileOutputStream(pfd.getFileDescriptor()); is = new FileInputStream(file);