diff --git a/Source/CParse/parser.y b/Source/CParse/parser.y index 876fd8e38..b9a509958 100644 --- a/Source/CParse/parser.y +++ b/Source/CParse/parser.y @@ -2404,10 +2404,10 @@ c_decl : storage_class type declarator initializer c_decl_tail { /* Look for "::" declarations (ignored) */ if (Strstr($3.id,"::")) { - if (Namespaceprefix) { - /* This is a special case. If the scope name of the declaration exactly - matches that of the declaration, then we will allow it. Otherwise, delete. */ - String *p = Swig_scopename_prefix($3.id); + /* This is a special case. If the scope name of the declaration exactly + matches that of the declaration, then we will allow it. Otherwise, delete. */ + String *p = Swig_scopename_prefix($3.id); + if (p && Namespaceprefix) { if (Strcmp(p,Namespaceprefix) == 0) { Setattr($$,"name",Swig_scopename_last($3.id)); set_nextSibling($$,$5);