From a001ab0284f647462a800b4c41a92fafb335308f Mon Sep 17 00:00:00 2001 From: wufanlong <14043878+wufanlong@user.noreply.gitee.com> Date: Sat, 3 Jan 2026 13:47:34 +0800 Subject: [PATCH] fix: handle service undefined --- index.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index fb15216..c0b742d 100644 --- a/index.js +++ b/index.js @@ -73,11 +73,12 @@ function convertRawJsonToScanResults(xmlInput) { const port = parseInt(portItem.$.portid) const protocol = portItem.$.protocol + let service, tunnel, method, product; if (portItem.service) { - const service = portItem.service[0].$.name - const tunnel = portItem.service[0].$.tunnel - const method = portItem.service[0].$.method - const product = portItem.service[0].$.tunnel + service = portItem.service[0].$.name + tunnel = portItem.service[0].$.tunnel + method = portItem.service[0].$.method + product = portItem.service[0].$.tunnel } let portObject = {}