catch rare NPE when determining max http size

This commit is contained in:
Daniel Gultsch 2016-04-29 13:24:26 +02:00
parent 252d015b71
commit 6d9ca25915
1 changed files with 3 additions and 3 deletions

View File

@ -27,6 +27,7 @@ import eu.siacs.conversations.entities.Message;
import eu.siacs.conversations.persistance.FileBackend; import eu.siacs.conversations.persistance.FileBackend;
import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService;
import eu.siacs.conversations.ui.adapter.ConversationAdapter; 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.InvalidJidException;
import eu.siacs.conversations.xmpp.jid.Jid; import eu.siacs.conversations.xmpp.jid.Jid;
@ -264,6 +265,8 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
private void share(final Conversation conversation) { private void share(final Conversation conversation) {
final Account account = conversation.getAccount(); final Account account = conversation.getAccount();
final XmppConnection connection = account.getXmppConnection();
final long max = connection == null ? -1 : connection.getFeatures().getMaxHttpUploadSize();
mListView.setEnabled(false); mListView.setEnabled(false);
if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP && !hasPgp()) { if (conversation.getNextEncryption() == Message.ENCRYPTION_PGP && !hasPgp()) {
if (share.uuid == null) { if (share.uuid == null) {
@ -275,9 +278,6 @@ public class ShareWithActivity extends XmppActivity implements XmppConnectionSer
return; return;
} }
if (share.uris.size() != 0) { if (share.uris.size() != 0) {
final long max = account.getXmppConnection()
.getFeatures()
.getMaxHttpUploadSize();
OnPresenceSelected callback = new OnPresenceSelected() { OnPresenceSelected callback = new OnPresenceSelected() {
@Override @Override
public void onPresenceSelected() { public void onPresenceSelected() {