bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

symbol: don't crash on symbol without content


From: Akim Demaille
Subject: symbol: don't crash on symbol without content
Date: Sat, 29 Dec 2018 16:44:30 +0100

commit 4d7df9aec7dbb3410098e867dc803811dde5a5c6
Author: Akim Demaille <address@hidden>
Date:   Sat Dec 29 09:19:45 2018 +0100

    symbol: don't crash on symbol without content
    
    When running with --trace=parse, we may crash.
    
    * src/symtab.c (symbol_print): Avoid that.

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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]