skip empty uris on attach
This commit is contained in:
parent
e9816a7f90
commit
4fbe2deffc
|
@ -139,6 +139,9 @@ public class Attachment implements Parcelable {
|
||||||
public static List<Attachment> of(final Context context, List<Uri> uris, final String type) {
|
public static List<Attachment> of(final Context context, List<Uri> uris, final String type) {
|
||||||
final List<Attachment> attachments = new ArrayList<>();
|
final List<Attachment> attachments = new ArrayList<>();
|
||||||
for (final Uri uri : uris) {
|
for (final Uri uri : uris) {
|
||||||
|
if (uri == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
final String mime = MimeUtils.guessMimeTypeFromUriAndMime(context, uri, type);
|
final String mime = MimeUtils.guessMimeTypeFromUriAndMime(context, uri, type);
|
||||||
attachments.add(new Attachment(uri, mime != null && isImage(mime) ? Type.IMAGE : Type.FILE, mime));
|
attachments.add(new Attachment(uri, mime != null && isImage(mime) ? Type.IMAGE : Type.FILE, mime));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue