Fixed crash for ''foo due to unsafe 'last'

This commit is contained in:
Vidar Holen 2013-07-01 09:14:33 -07:00
parent 652f8a24fa
commit 651bab73de
1 changed files with 1 additions and 1 deletions

View File

@ -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