forked from mirror/monocles_chat_clean
Fix several NPE
This commit is contained in:
parent
d12c91a614
commit
2e4d02fb08
3 changed files with 9 additions and 5 deletions
|
@ -30,6 +30,7 @@ import java.util.Arrays;
|
|||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
|
||||
import eu.siacs.conversations.Config;
|
||||
|
@ -309,7 +310,7 @@ public class ChooseContactActivity extends AbstractSearchableListItemActivity im
|
|||
Collections.sort(getListItems());
|
||||
getListItemAdapter().notifyDataSetChanged();
|
||||
for (int i = 0; i < getListItemAdapter().getCount(); i++) {
|
||||
getListView().setItemChecked(i, selected.contains(getListItemAdapter().getItem(i).getJid().toString()));
|
||||
getListView().setItemChecked(i, selected.contains(Objects.requireNonNull(getListItemAdapter().getItem(i)).getJid().toString()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4201,7 +4201,7 @@ public class ConversationFragment extends XmppFragment
|
|||
final Conversation c = this.conversation;
|
||||
final Presence.Status status;
|
||||
final String text =
|
||||
this.binding.textinput == null ? "" : this.binding.textinput.getText().toString();
|
||||
this.binding.textinput == null ? "" : Objects.requireNonNull(this.binding.textinput.getText()).toString();
|
||||
final SendButtonAction action;
|
||||
if (hasAttachments) {
|
||||
action = SendButtonAction.TEXT;
|
||||
|
@ -4232,14 +4232,15 @@ public class ConversationFragment extends XmppFragment
|
|||
this.binding.textSendButton.setIconResource(
|
||||
SendButtonTool.getSendButtonImageResource(action, text.length() > 0 || hasAttachments || (c.getThread() != null && binding.textinputSubject.getText().length() > 0)));
|
||||
}
|
||||
final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(getActivity());
|
||||
if (activity == null) return;
|
||||
final SharedPreferences pref = PreferenceManager.getDefaultSharedPreferences(activity);
|
||||
ViewGroup.LayoutParams params = binding.threadIdenticonLayout.getLayoutParams();
|
||||
if (identiconWidth < 0) identiconWidth = params.width;
|
||||
if (hasAttachments || binding.textinput.getText().toString().replaceFirst("^(\\w|[, ])+:\\s*", "").length() > 0) {
|
||||
binding.conversationViewPager.setCurrentItem(0);
|
||||
params.width = conversation.getThread() == null ? 0 : identiconWidth;
|
||||
binding.quickButtons.setVisibility(GONE);
|
||||
} else if (pref.getBoolean("show_thread_feature", getResources().getBoolean(R.bool.show_thread_feature))) {
|
||||
} else if (pref != null && pref.getBoolean("show_thread_feature", getResources().getBoolean(R.bool.show_thread_feature))) {
|
||||
params.width = identiconWidth;
|
||||
binding.quickButtons.setVisibility(VISIBLE);
|
||||
} else {
|
||||
|
|
|
@ -592,7 +592,9 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio
|
|||
}
|
||||
|
||||
public void launchStartConversation(int goTo) {
|
||||
StartConversationActivity.launch(this, (Account) accountHeader.getActiveProfile().getTag(), selectedTag == null ? null : selectedTag.getName(), goTo);
|
||||
if (accountHeader.getActiveProfile() != null) {
|
||||
StartConversationActivity.launch(this, (Account) accountHeader.getActiveProfile().getTag(), selectedTag == null ? null : selectedTag.getName(), goTo);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean performRedirectIfNecessary(boolean noAnimation) {
|
||||
|
|
Loading…
Add table
Reference in a new issue