Check for null URIs

This commit is contained in:
M66B
2021-08-07 08:11:34 +02:00
parent 1f449c9e58
commit 8f46bdebd1
6 changed files with 43 additions and 8 deletions

View File

@@ -19,6 +19,9 @@ package eu.faircode.email;
Copyright 2018-2021 by Marcel Bokhorst (M66B)
*/
import static android.app.ActionBar.DISPLAY_SHOW_CUSTOM;
import static android.app.Activity.RESULT_OK;
import android.app.RecoverableSecurityException;
import android.content.ActivityNotFoundException;
import android.content.BroadcastReceiver;
@@ -65,9 +68,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import static android.app.ActionBar.DISPLAY_SHOW_CUSTOM;
import static android.app.Activity.RESULT_OK;
public class FragmentBase extends Fragment {
private String title = null;
private String subtitle = " ";
@@ -477,6 +477,9 @@ public class FragmentBase extends Fragment {
long id = args.getLong("id");
Uri uri = args.getParcelable("uri");
if (uri == null)
throw new FileNotFoundException();
if (!"content".equals(uri.getScheme())) {
Log.w("Save attachment uri=" + uri);
throw new IllegalArgumentException(context.getString(R.string.title_no_stream));
@@ -552,6 +555,9 @@ public class FragmentBase extends Fragment {
long id = args.getLong("id");
Uri uri = args.getParcelable("uri");
if (uri == null)
throw new FileNotFoundException();
if (!"content".equals(uri.getScheme())) {
Log.w("Save attachment uri=" + uri);
throw new IllegalArgumentException(context.getString(R.string.title_no_stream));