From 95498f0341ec414b0324855107b27b38e7688395 Mon Sep 17 00:00:00 2001 From: Pierce Brooks Date: Tue, 17 Jan 2023 11:27:45 -0500 Subject: [PATCH] fix minor crash seemingly arising from unterminated encapsulation token pairings --- python/jsbeautifier/javascript/tokenizer.py | 1 + 1 file changed, 1 insertion(+) diff --git a/python/jsbeautifier/javascript/tokenizer.py b/python/jsbeautifier/javascript/tokenizer.py index a121a31ac..0787dbca8 100644 --- a/python/jsbeautifier/javascript/tokenizer.py +++ b/python/jsbeautifier/javascript/tokenizer.py @@ -526,6 +526,7 @@ def allowRegExOrXML(self, previous_token): or ( previous_token.type == TOKEN.END_EXPR and previous_token.text == ")" + and previous_token.opened != None and previous_token.opened.previous.type == TOKEN.RESERVED and previous_token.opened.previous.text in {"if", "while", "for"} )