diff --git a/tools/qfcc/source/qc-parse.y b/tools/qfcc/source/qc-parse.y index af10e66a4..897a2b924 100644 --- a/tools/qfcc/source/qc-parse.y +++ b/tools/qfcc/source/qc-parse.y @@ -535,8 +535,10 @@ builtin_function def_t *def = $-1; if (!def->external) { $$ = build_builtin_function (def, $0); - build_scope ($$, $$->def, current_params); - flush_scope ($$->scope, 1); + if ($$) { + build_scope ($$, $$->def, current_params); + flush_scope ($$->scope, 1); + } } } ; diff --git a/tools/qfcc/source/qp-parse.y b/tools/qfcc/source/qp-parse.y index 38d6bc6e1..9612b35b2 100644 --- a/tools/qfcc/source/qp-parse.y +++ b/tools/qfcc/source/qp-parse.y @@ -252,8 +252,10 @@ subprogram_declaration | subprogram_head ASSIGNOP '#' const ';' { $$ = build_builtin_function ($1, $4); - build_scope ($$, $$->def, current_params); - flush_scope ($$->scope, 1); + if ($$) { + build_scope ($$, $$->def, current_params); + flush_scope ($$->scope, 1); + } } ;