showId: Handle empty attribute names

We should probably disallow these, but until then, we shouldn't barf
with an assertion failure.

Fixes #738.
This commit is contained in:
Eelco Dolstra 2015-12-17 15:15:28 +01:00
parent 338880ee6f
commit a9faa7bbce

View file

@ -30,8 +30,9 @@ static void showString(std::ostream & str, const string & s)
static void showId(std::ostream & str, const string & s)
{
assert(!s.empty());
if (s == "if")
if (s.empty())
str << "\"\"";
else if (s == "if") // FIXME: handle other keywords
str << '"' << s << '"';
else {
char c = s[0];