From 53e19a2e9c304301fec455a60b10fc923420482b Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Thu, 19 Sep 2019 11:42:30 +0200 Subject: fixed some minor NPE --- .../java/de/pixart/messenger/services/XmppConnectionService.java | 7 ++++++- src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 3 ++- .../de/pixart/messenger/ui/adapter/ChannelSearchResultAdapter.java | 4 +++- .../de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java | 6 ++---- 4 files changed, 13 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java index 5d3e8d2c2..a3bd141ac 100644 --- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java +++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java @@ -2843,6 +2843,9 @@ public class XmppConnectionService extends Service { Account account = conversation.getAccount(); final MucOptions mucOptions = conversation.getMucOptions(); if (mucOptions.nonanonymous() && !mucOptions.membersOnly() && !conversation.getBooleanAttribute("accept_non_anonymous", false)) { + synchronized (account.inProgressConferenceJoins) { + account.inProgressConferenceJoins.remove(conversation); + } mucOptions.setError(MucOptions.Error.NON_ANONYMOUS); updateConversationUi(); if (onConferenceJoined != null) { @@ -3299,7 +3302,9 @@ public class XmppConnectionService extends Service { } updateConversationUi(); - } else if (packet.getType() == IqPacket.TYPE.ERROR) { + } else if (packet.getType() == IqPacket.TYPE.TIMEOUT) { + Log.d(Config.LOGTAG, account.getJid().asBareJid() + ": received timeout waiting for conference configuration fetch"); + } else { if (callback != null) { callback.onFetchFailed(conversation, packet.getError()); } diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index 859ef132f..6f29655f6 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -1775,7 +1775,8 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke intent = new Intent(getActivity(), ShareLocationActivity.class); break; } - if (intent.resolveActivity(getActivity().getPackageManager()) != null) { + final Context context = getActivity(); + if (context != null && intent.resolveActivity(context.getPackageManager()) != null) { Log.d(Config.LOGTAG, "Attachment: " + attachmentChoice); if (chooser) { startActivityForResult( diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ChannelSearchResultAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ChannelSearchResultAdapter.java index bfb9665be..dee701c9d 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/ChannelSearchResultAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/ChannelSearchResultAdapter.java @@ -16,6 +16,7 @@ import de.pixart.messenger.R; import de.pixart.messenger.databinding.SearchResultItemBinding; import de.pixart.messenger.http.services.MuclumbusService; import de.pixart.messenger.ui.util.AvatarWorkerTask; +import rocks.xmpp.addr.Jid; public class ChannelSearchResultAdapter extends ListAdapter { @@ -62,7 +63,8 @@ public class ChannelSearchResultAdapter extends ListAdapter listener.onChannelSearchResult(searchResult)); } diff --git a/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java b/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java index aaf2a39ec..5d2c47d72 100644 --- a/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java +++ b/src/main/java/de/pixart/messenger/ui/util/MucDetailsContextMenuHelper.java @@ -153,6 +153,8 @@ public final class MucDetailsContextMenuHelper { activity.xmppConnectionService.changeAffiliationInConference(conversation, jid, MucOptions.Affiliation.ADMIN, onAffiliationChanged); return true; case R.id.give_membership: + case R.id.remove_admin_privileges: + case R.id.revoke_owner_privileges: activity.xmppConnectionService.changeAffiliationInConference(conversation, jid, MucOptions.Affiliation.MEMBER, onAffiliationChanged); return true; case R.id.give_owner_privileges: @@ -161,10 +163,6 @@ public final class MucDetailsContextMenuHelper { case R.id.remove_membership: activity.xmppConnectionService.changeAffiliationInConference(conversation, jid, MucOptions.Affiliation.NONE, onAffiliationChanged); return true; - case R.id.remove_admin_privileges: - case R.id.revoke_owner_privileges: - activity.xmppConnectionService.changeAffiliationInConference(conversation, jid, MucOptions.Affiliation.MEMBER, onAffiliationChanged); - return true; case R.id.kick_from_room: kickFromRoom(user, activity, onAffiliationChanged); return true; -- cgit v1.2.3