Change summary
src/main/java/eu/siacs/conversations/entities/Conversation.java | 4
src/main/java/eu/siacs/conversations/ui/ConversationFragment.java | 2
2 files changed, 4 insertions(+), 2 deletions(-)
Detailed changes
@@ -2632,7 +2632,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
}
for (Element el : command.getChildren()) {
- if (el.getName().equals("x") && el.getNamespace().equals("jabber:x:data")) {
+ if ("x".equals(el.getName()) && "jabber:x:data".equals(el.getNamespace())) {
Data form = Data.parse(el);
String title = form.getTitle();
if (title != null) {
@@ -2640,7 +2640,7 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
ConversationPagerAdapter.this.notifyDataSetChanged();
}
- if (el.getAttribute("type").equals("result") || el.getAttribute("type").equals("form")) {
+ if ("result".equals(el.getAttribute("type")) || "form".equals(el.getAttribute("type"))) {
this.responseElement = el;
setupReported(el.findChild("reported", "jabber:x:data"));
if (mBinding != null) mBinding.form.setLayoutManager(setupLayoutManager());
@@ -2884,6 +2884,8 @@ public class ConversationFragment extends XmppFragment
commandAdapter = new CommandAdapter((XmppActivity) getActivity());
binding.commandsView.setAdapter(commandAdapter);
binding.commandsView.setOnItemClickListener((parent, view, position, id) -> {
+ if (activity == null) return;
+
final Element command = commandAdapter.getItem(position);
activity.startCommand(conversation.getAccount(), command.getAttributeAsJid("jid"), command.getAttribute("node"));
});