mirror of
https://github.com/moparisthebest/Conversations
synced 2024-11-27 19:22:15 -05:00
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) {
|
} else if (requestCode == ATTACHMENT_CHOICE_CHOOSE_FILE || requestCode == ATTACHMENT_CHOICE_RECORD_VOICE) {
|
||||||
final List<Uri> uris = extractUriFromIntent(data);
|
final List<Uri> uris = extractUriFromIntent(data);
|
||||||
final Conversation c = getSelectedConversation();
|
final Conversation c = getSelectedConversation();
|
||||||
final long max = c.getAccount()
|
|
||||||
.getXmppConnection()
|
|
||||||
.getFeatures()
|
|
||||||
.getMaxHttpUploadSize();
|
|
||||||
final OnPresenceSelected callback = new OnPresenceSelected() {
|
final OnPresenceSelected callback = new OnPresenceSelected() {
|
||||||
@Override
|
@Override
|
||||||
public void onPresenceSelected() {
|
public void onPresenceSelected() {
|
||||||
@ -1317,8 +1313,8 @@ public class ConversationActivity extends XmppActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (c.getMode() == Conversation.MODE_MULTI
|
if (c == null || c.getMode() == Conversation.MODE_MULTI
|
||||||
|| FileBackend.allFilesUnderSize(this, uris, max)
|
|| FileBackend.allFilesUnderSize(this, uris, getMaxHttpUploadSize(c))
|
||||||
|| c.getNextEncryption() == Message.ENCRYPTION_OTR) {
|
|| c.getNextEncryption() == Message.ENCRYPTION_OTR) {
|
||||||
callback.onPresenceSelected();
|
callback.onPresenceSelected();
|
||||||
} else {
|
} else {
|
||||||
@ -1367,6 +1363,10 @@ public class ConversationActivity extends XmppActivity
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private long getMaxHttpUploadSize(Conversation conversation) {
|
||||||
|
return conversation.getAccount().getXmppConnection().getFeatures().getMaxHttpUploadSize();
|
||||||
|
}
|
||||||
|
|
||||||
private void setNeverAskForBatteryOptimizationsAgain() {
|
private void setNeverAskForBatteryOptimizationsAgain() {
|
||||||
getPreferences().edit().putBoolean("show_battery_optimization", false).commit();
|
getPreferences().edit().putBoolean("show_battery_optimization", false).commit();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user