From f6dd335aa6cdab382b7e0041a933c72d89d8e12f Mon Sep 17 00:00:00 2001 From: Tim Wu Date: Sun, 17 Nov 2024 22:50:25 +0800 Subject: [PATCH] Update Parser.js Add a safe check for list[i] --- lib/Parser.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Parser.js b/lib/Parser.js index 1dd386ba..ec63fb1e 100644 --- a/lib/Parser.js +++ b/lib/Parser.js @@ -428,7 +428,7 @@ function parseFetch(text, literals, seqno) { var list = parseExpr(text, literals)[0], attrs = {}, m, body; // list is [KEY1, VAL1, KEY2, VAL2, .... KEYn, VALn] for (var i = 0, len = list.length, key, val; i < len; i += 2) { - key = list[i].toLowerCase(); + key = list[i] && list[i].toLowerCase(); val = list[i + 1]; if (key === 'envelope') val = parseFetchEnvelope(val);