diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index 1fa8484d6deda76ed8a81c5ae12b107ba431cf5c..32d0ca05c841a7f66c6998afb734901ffd82b01b 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -2088,16 +2088,11 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl public boolean execute(String action) { if (!action.equals("cancel") && !validate()) return false; - if (response == null || responseElement == null) return true; + if (response == null) return true; Element command = response.findChild("command", "http://jabber.org/protocol/commands"); if (command == null) return true; String status = command.getAttribute("status"); if (status == null || !status.equals("executing")) return true; - if (!responseElement.getName().equals("x") || !responseElement.getNamespace().equals("jabber:x:data")) return true; - String formType = responseElement.getAttribute("type"); - if (formType == null || !formType.equals("form")) return true; - - responseElement.setAttribute("type", "submit"); final IqPacket packet = new IqPacket(IqPacket.TYPE.SET); packet.setTo(response.getFrom()); @@ -2105,7 +2100,16 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl c.setAttribute("node", command.getAttribute("node")); c.setAttribute("sessionid", command.getAttribute("sessionid")); c.setAttribute("action", action); - c.addChild(responseElement); + + String formType = responseElement == null ? null : responseElement.getAttribute("type"); + if (responseElement != null && + responseElement.getName().equals("x") && + responseElement.getNamespace().equals("jabber:x:data") && + formType != null && formType.equals("form")) { + + responseElement.setAttribute("type", "submit"); + c.addChild(responseElement); + } xmppConnectionService.sendIqPacket(getAccount(), packet, (a, iq) -> { getView().post(() -> {