diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-09-19 11:42:30 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-09-19 11:42:30 +0200 |
commit | 53e19a2e9c304301fec455a60b10fc923420482b (patch) | |
tree | ecb6fe0a11c779b3459c5bbe0b6547ca6966c11d /src | |
parent | 03530f667d664d5c015784c42dda671ccf6003b2 (diff) |
fixed some minor NPE
Diffstat (limited to 'src')
4 files changed, 13 insertions, 7 deletions
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<MuclumbusService.Room, ChannelSearchResultAdapter.ViewHolder> { @@ -62,7 +63,8 @@ public class ChannelSearchResultAdapter extends ListAdapter<MuclumbusService.Roo viewHolder.binding.language.setText("(" + language.toUpperCase(Locale.ENGLISH) + ")"); viewHolder.binding.language.setVisibility(View.VISIBLE); } - viewHolder.binding.room.setText(searchResult.getRoom().asBareJid().toString()); + final Jid room = searchResult.getRoom(); + viewHolder.binding.room.setText(room != null ? room.asBareJid().toString() : ""); AvatarWorkerTask.loadAvatar(searchResult, viewHolder.binding.avatar, R.dimen.avatar); viewHolder.binding.getRoot().setOnClickListener(v -> 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; |