diff --git a/WordPress/src/main/java/org/wordpress/android/ui/ShareIntentReceiverActivity.java b/WordPress/src/main/java/org/wordpress/android/ui/ShareIntentReceiverActivity.java index 2542f11dc0ab..bbdd6ed3f221 100644 --- a/WordPress/src/main/java/org/wordpress/android/ui/ShareIntentReceiverActivity.java +++ b/WordPress/src/main/java/org/wordpress/android/ui/ShareIntentReceiverActivity.java @@ -97,13 +97,13 @@ private void downloadExternalMedia() { if (Intent.ACTION_SEND_MULTIPLE.equals(getIntent().getAction())) { ArrayList externalUris = getIntent().getParcelableArrayListExtra((Intent.EXTRA_STREAM)); for (Uri uri : externalUris) { - if (isAllowedMediaType(uri)) { + if (uri != null && isAllowedMediaType(uri)) { mLocalMediaUris.add(MediaUtils.downloadExternalMedia(this, uri)); } } } else if (Intent.ACTION_SEND.equals(getIntent().getAction())) { Uri externalUri = getIntent().getParcelableExtra(Intent.EXTRA_STREAM); - if (isAllowedMediaType(externalUri)) { + if (externalUri != null && isAllowedMediaType(externalUri)) { mLocalMediaUris.add(MediaUtils.downloadExternalMedia(this, externalUri)); } } @@ -182,7 +182,7 @@ private void startActivityAndFinish(@NonNull Intent intent, int mSelectedSiteLoc if (Intent.ACTION_SEND_MULTIPLE.equals(action)) { intent.putExtra(Intent.EXTRA_STREAM, mLocalMediaUris); - } else if (Intent.ACTION_SEND.equals(action)) { + } else if (Intent.ACTION_SEND.equals(action) && !mLocalMediaUris.isEmpty()) { intent.putExtra(Intent.EXTRA_STREAM, mLocalMediaUris.get(0)); }