Fix possible NPE

This commit is contained in:
Arne 2024-09-16 21:27:07 +02:00
parent 5b0c1a6a06
commit 1ece485d65

View file

@ -2997,20 +2997,21 @@ public class ConversationFragment extends XmppFragment
}
private void updateThreadFromLastMessage() {
if (activity.xmppConnectionService != null && activity.xmppConnectionService.getBooleanPreference("show_thread_feature", R.bool.show_thread_feature)) {
if (this.conversation != null && !this.conversation.getUserSelectedThread() && TextUtils.isEmpty(binding.textinput.getText())) {
Message message = getLastVisibleMessage();
if (message == null) {
if (this.conversation != null && !this.conversation.getUserSelectedThread() && TextUtils.isEmpty(binding.textinput.getText())) {
Message message = getLastVisibleMessage();
if (message == null) {
if (activity.xmppConnectionService != null && activity.xmppConnectionService.getBooleanPreference("show_thread_feature", R.bool.show_thread_feature)) {
newThread();
} else {
if (conversation.getMode() == Conversation.MODE_MULTI) {
if (activity == null || activity.xmppConnectionService == null) return;
if (message.getStatus() < Message.STATUS_SEND) {
if (!activity.xmppConnectionService.getBooleanPreference("follow_thread_in_channel", R.bool.follow_thread_in_channel))
return;
}
}
} else {
if (conversation.getMode() == Conversation.MODE_MULTI) {
if (activity == null || activity.xmppConnectionService == null) return;
if (message.getStatus() < Message.STATUS_SEND) {
if (activity.xmppConnectionService != null && !activity.xmppConnectionService.getBooleanPreference("follow_thread_in_channel", R.bool.follow_thread_in_channel))
return;
}
}
if (activity.xmppConnectionService != null && activity.xmppConnectionService.getBooleanPreference("show_thread_feature", R.bool.show_thread_feature)) {
setThread(message.getThread());
}
}