From 8a9091a998c3d8ad0b6e5ff6ff0629c9faac6936 Mon Sep 17 00:00:00 2001 From: Tim Sharpe Date: Wed, 25 Sep 2019 13:27:41 +1000 Subject: [PATCH] Report syntax error on unbalanced braces Rather than throwing an unhandled exception. Fixes #740 --- lib/puppet-lint/lexer/token.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/puppet-lint/lexer/token.rb b/lib/puppet-lint/lexer/token.rb index aee445d1..c4244890 100644 --- a/lib/puppet-lint/lexer/token.rb +++ b/lib/puppet-lint/lexer/token.rb @@ -193,6 +193,8 @@ def find_token_of(direction, type, opts = {}) token_iter = token_iter.send("#{direction}_token_of".to_sym, ["#{closing_token}PAREN".to_sym, opts]) end end + + return nil if token_iter.nil? token_iter = token_iter.send("#{direction}_token".to_sym) end nil