From caab12d0812922b04417cbdabd4690c732a76199 Mon Sep 17 00:00:00 2001 From: Thomas Date: Mon, 6 Jun 2022 15:59:08 +0200 Subject: [PATCH] Fix issue #130 - Fix a crash when the instance does not provide allowed mimetypes. --- .../app/fedilab/android/ui/drawer/ComposeAdapter.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java b/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java index e85540bf5..afbce5a0c 100644 --- a/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java +++ b/app/src/main/java/app/fedilab/android/ui/drawer/ComposeAdapter.java @@ -281,25 +281,25 @@ public class ComposeAdapter extends RecyclerView.Adapter 0) { + if (instanceInfo.getMimeTypeImage() != null && instanceInfo.getMimeTypeImage().size() > 0) { mimetypes = instanceInfo.getMimeTypeImage().toArray(new String[0]); } else { mimetypes = new String[]{"image/*"}; } } else if (type == ComposeActivity.mediaType.VIDEO) { - if (instanceInfo.getMimeTypeVideo().size() > 0) { + if (instanceInfo.getMimeTypeVideo() != null && instanceInfo.getMimeTypeVideo().size() > 0) { mimetypes = instanceInfo.getMimeTypeVideo().toArray(new String[0]); } else { mimetypes = new String[]{"video/*"}; } } else if (type == ComposeActivity.mediaType.AUDIO) { - if (instanceInfo.getMimeTypeAudio().size() > 0) { + if (instanceInfo.getMimeTypeAudio() != null && instanceInfo.getMimeTypeAudio().size() > 0) { mimetypes = instanceInfo.getMimeTypeAudio().toArray(new String[0]); } else { mimetypes = new String[]{"audio/mpeg", "audio/opus", "audio/flac", "audio/wav", "audio/ogg"}; } } else if (type == ComposeActivity.mediaType.ALL) { - if (instanceInfo.getMimeTypeOther().size() > 0) { + if (instanceInfo.getMimeTypeOther() != null && instanceInfo.getMimeTypeOther().size() > 0) { mimetypes = instanceInfo.getMimeTypeOther().toArray(new String[0]); } else { mimetypes = new String[]{"*/*"};