diff --git a/java_client/src/main/java/com/example/wxhk/msg/WxMsgHandle.java b/java_client/src/main/java/com/example/wxhk/msg/WxMsgHandle.java index 8eccec9..b43769b 100644 --- a/java_client/src/main/java/com/example/wxhk/msg/WxMsgHandle.java +++ b/java_client/src/main/java/com/example/wxhk/msg/WxMsgHandle.java @@ -206,7 +206,11 @@ public class WxMsgHandle { try { String content = chatMsg.getContent(); Document document = XmlUtil.parseXml(content); - Node paysubtype = document.getElementsByTagName("paysubtype").item(0); + NodeList paysubtype1 = document.getElementsByTagName("paysubtype"); + if(paysubtype1.getLength()==0){ + return true; + } + Node paysubtype = paysubtype1.item(0); if ("1".equals(paysubtype.getTextContent().trim())) { // 手机发出去的 String textContent = document.getElementsByTagName("receiver_username").item(0).getTextContent();