From 932647bad368c8a24f8123641bb346ffa921b538 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 10 Jan 2016 13:41:49 +0900 Subject: [PATCH] Fix a segfault with switch on an undefined symbol. Forgot to check if the test expression was not an error. --- tools/qfcc/source/switch.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/qfcc/source/switch.c b/tools/qfcc/source/switch.c index f6b05547c..80321a9ab 100644 --- a/tools/qfcc/source/switch.c +++ b/tools/qfcc/source/switch.c @@ -405,6 +405,10 @@ switch_expr (switch_block_t *switch_block, expr_t *break_label, int saved_line = pr.source_line; string_t saved_file = pr.source_file; + if (switch_block->test->type == ex_error) { + return switch_block->test; + } + pr.source_line = sw_val->line = switch_block->test->line; pr.source_file = sw_val->file = switch_block->test->file;