From 6d9ca2591575a5e04d554a168e45413a628f6540 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Fri, 29 Apr 2016 13:24:26 +0200 Subject: [PATCH] catch rare NPE when determining max http size --- .../java/eu/siacs/conversations/ui/ShareWithActivity.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java index 4ed015f4..9a7414ef 100644 --- a/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ShareWithActivity.java @@ -27,6 +27,7 @@ import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.persistance.FileBackend; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.ui.adapter.ConversationAdapter; +import eu.siacs.conversations.xmpp.XmppConnection; import eu.siacs.conversations.xmpp.jid.InvalidJidException; import eu.siacs.conversations.xmpp.jid.Jid; @@ -264,6 +265,8 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer private void share(final Conversation conversation) { final Account account = conversation.getAccount(); + final XmppConnection connection = account.getXmppConnection(); + final long max = connection == null ? -1 : connection.getFeatures().getMaxHttpUploadSize(); mListView.setEnabled(false); if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP && !hasPgp()) { if (share.uuid == null) { @@ -275,9 +278,6 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer return; } if (share.uris.size() != 0) { - final long max = account.getXmppConnection() - .getFeatures() - .getMaxHttpUploadSize(); OnPresenceSelected callback = new OnPresenceSelected() { @Override public void onPresenceSelected() {