From 651bab73de40f8137dd032ed71e5dcb16f8d562c Mon Sep 17 00:00:00 2001 From: Vidar Holen Date: Mon, 1 Jul 2013 09:14:33 -0700 Subject: [PATCH] Fixed crash for ''foo due to unsafe 'last' --- ShellCheck/Parser.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ShellCheck/Parser.hs b/ShellCheck/Parser.hs index 5491410..6c9719e 100644 --- a/ShellCheck/Parser.hs +++ b/ShellCheck/Parser.hs @@ -644,7 +644,7 @@ readSingleQuoted = called "single quoted string" $ do let string = concat s return (T_SingleQuoted id string) `attempting` do x <- lookAhead anyChar - when (isAlpha x && isAlpha (last string)) $ parseProblemAt pos WarningC "This apostrophe terminated the single quoted string!" + when (isAlpha x && not (null string) && isAlpha (last string)) $ parseProblemAt pos WarningC "This apostrophe terminated the single quoted string!" readSingleQuotedLiteral = do singleQuote