diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-12-17 15:15:28 +0100 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-12-17 15:15:28 +0100 |
commit | a9faa7bbce963ddb894699a7cc6ea8a3876e4d9f (patch) | |
tree | 480b29447fbf6fdfd80b77736f0ab206010ed77b /src/libexpr | |
parent | 338880ee6fc2d8f55dcbe0f0b7313cd69dc866d0 (diff) |
showId: Handle empty attribute names
We should probably disallow these, but until then, we shouldn't barf
with an assertion failure.
Fixes #738.
Diffstat (limited to 'src/libexpr')
-rw-r--r-- | src/libexpr/nixexpr.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/libexpr/nixexpr.cc b/src/libexpr/nixexpr.cc index 35db52a13..5bc8e4202 100644 --- a/src/libexpr/nixexpr.cc +++ b/src/libexpr/nixexpr.cc @@ -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]; |