mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-22 02:11:19 +00:00
[qfcc] Check switch test expression early
Avoids a segfault when the test expression has errors.
This commit is contained in:
parent
3059aa7979
commit
95991e0d77
1 changed files with 4 additions and 4 deletions
|
@ -395,6 +395,10 @@ struct expr_s *
|
|||
switch_expr (switch_block_t *switch_block, expr_t *break_label,
|
||||
expr_t *statements)
|
||||
{
|
||||
if (switch_block->test->type == ex_error) {
|
||||
return switch_block->test;
|
||||
}
|
||||
|
||||
case_label_t **labels, **l;
|
||||
case_label_t _default_label;
|
||||
case_label_t *default_label = &_default_label;
|
||||
|
@ -406,10 +410,6 @@ 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;
|
||||
|
||||
|
|
Loading…
Reference in a new issue