From 4d7df9aec7dbb3410098e867dc803811dde5a5c6 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Sat, 29 Dec 2018 09:19:45 +0100 Subject: [PATCH] symbol: don't crash on symbol without content When running with --trace=parse, we may crash. * src/symtab.c (symbol_print): Avoid that. --- src/symtab.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/symtab.c b/src/symtab.c index 9dbc79f6..2409f41c 100644 --- a/src/symtab.c +++ b/src/symtab.c @@ -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