symbol: don't crash on symbol without content

When running with --trace=parse, we may crash.

* src/symtab.c (symbol_print): Avoid that.
This commit is contained in:
Akim Demaille
2018-12-29 09:19:45 +01:00
parent 7c25df547e
commit 4d7df9aec7

View File

@@ -210,11 +210,11 @@ semantic_type_new (uniqstr tag, const location *loc)
`-----------------*/
#define SYMBOL_ATTR_PRINT(Attr) \
if (s->content->Attr) \
if (s->content && s->content->Attr) \
fprintf (f, " %s { %s }", #Attr, s->content->Attr)
#define SYMBOL_CODE_PRINT(Attr) \
if (s->content->props[Attr].code) \
if (s->content && s->content->props[Attr].code) \
fprintf (f, " %s { %s }", #Attr, s->content->props[Attr].code)
void