Fix out-of-bounds error when parsing expression

When swallowing a '{', the code forgot to check that there was at least one
character after that. Fix, add test.