diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-08-19 21:46:47 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-08-26 19:42:49 +0200 |
commit | eec2083fabcea61a1dc8226a3b76d21514f32d1a (patch) | |
tree | 2f2c2bf76dbf37c201db41d319b72f7c43dce525 /src/main/java/de/pixart | |
parent | da1edafd495b82a0a9b176f7718cd3fe7b334521 (diff) |
check for rare null pointer platform bug in share intent handling
Diffstat (limited to 'src/main/java/de/pixart')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationActivity.java | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java index 0d38c98f2..484e9326b 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationActivity.java @@ -1501,6 +1501,26 @@ public class ConversationActivity extends XmppActivity xmppConnectionService.getNotificationService().setOpenConversation(null); } + @SuppressLint("NewApi") + private static List<Uri> extractUriFromIntent(final Intent intent) { + List<Uri> uris = new ArrayList<>(); + if (intent == null) { + return uris; + } + Uri uri = intent.getData(); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2 && uri == null) { + final ClipData clipData = intent.getClipData(); + if (clipData != null) { + for (int i = 0; i < clipData.getItemCount(); ++i) { + uris.add(clipData.getItemAt(i).getUri()); + } + } + } else { + uris.add(uri); + } + return uris; + } + @Override protected void onActivityResult(int requestCode, int resultCode, final Intent data) { super.onActivityResult(requestCode, resultCode, data); |