数据判断,避免抛出错误

This commit is contained in:
王涛 2023-06-02 09:48:59 +08:00
parent a3d689d80a
commit a94dfa9f71

View File

@ -206,7 +206,11 @@ public class WxMsgHandle {
try { try {
String content = chatMsg.getContent(); String content = chatMsg.getContent();
Document document = XmlUtil.parseXml(content); 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())) { if ("1".equals(paysubtype.getTextContent().trim())) {
// 手机发出去的 // 手机发出去的
String textContent = document.getElementsByTagName("receiver_username").item(0).getTextContent(); String textContent = document.getElementsByTagName("receiver_username").item(0).getTextContent();