prevent null pointer when checking http upload max size
This commit is contained in:
parent
275d6a858c
commit
290f0a123e
|
@ -1301,10 +1301,6 @@ public class ConversationActivity extends XmppActivity
|
|||
} else if (requestCode == ATTACHMENT_CHOICE_CHOOSE_FILE || requestCode == ATTACHMENT_CHOICE_RECORD_VOICE) {
|
||||
final List<Uri> uris = extractUriFromIntent(data);
|
||||
final Conversation c = getSelectedConversation();
|
||||
final long max = c.getAccount()
|
||||
.getXmppConnection()
|
||||
.getFeatures()
|
||||
.getMaxHttpUploadSize();
|
||||
final OnPresenceSelected callback = new OnPresenceSelected() {
|
||||
@Override
|
||||
public void onPresenceSelected() {
|
||||
|
@ -1317,8 +1313,8 @@ public class ConversationActivity extends XmppActivity
|
|||
}
|
||||
}
|
||||
};
|
||||
if (c.getMode() == Conversation.MODE_MULTI
|
||||
|| FileBackend.allFilesUnderSize(this, uris, max)
|
||||
if (c == null || c.getMode() == Conversation.MODE_MULTI
|
||||
|| FileBackend.allFilesUnderSize(this, uris, getMaxHttpUploadSize(c))
|
||||
|| c.getNextEncryption() == Message.ENCRYPTION_OTR) {
|
||||
callback.onPresenceSelected();
|
||||
} else {
|
||||
|
@ -1367,6 +1363,10 @@ public class ConversationActivity extends XmppActivity
|
|||
}
|
||||
}
|
||||
|
||||
private long getMaxHttpUploadSize(Conversation conversation) {
|
||||
return conversation.getAccount().getXmppConnection().getFeatures().getMaxHttpUploadSize();
|
||||
}
|
||||
|
||||
private void setNeverAskForBatteryOptimizationsAgain() {
|
||||
getPreferences().edit().putBoolean("show_battery_optimization", false).commit();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue