mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-26 12:53:13 +00:00
Fix for crash with malformed switch statement. Fixes #1376
This commit is contained in:
parent
005edf71a8
commit
74b28f0a86
1 changed files with 15 additions and 13 deletions
|
@ -547,13 +547,15 @@ parse_execution_result_t parse_execution_context_t::run_switch_statement(const p
|
|||
_(L"switch: Expected exactly one argument, got %lu\n"),
|
||||
switch_values_expanded.size());
|
||||
}
|
||||
|
||||
if (result == parse_execution_success)
|
||||
{
|
||||
const wcstring &switch_value_expanded = switch_values_expanded.at(0).completion;
|
||||
|
||||
switch_block_t *sb = new switch_block_t();
|
||||
parser->push_block(sb);
|
||||
|
||||
if (result == parse_execution_success)
|
||||
{
|
||||
|
||||
/* Expand case statements */
|
||||
const parse_node_t *case_item_list = get_child(statement, 3, symbol_case_item_list);
|
||||
|
||||
|
@ -597,7 +599,6 @@ parse_execution_result_t parse_execution_context_t::run_switch_statement(const p
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result == parse_execution_success && matching_case_item != NULL)
|
||||
{
|
||||
|
@ -607,6 +608,7 @@ parse_execution_result_t parse_execution_context_t::run_switch_statement(const p
|
|||
}
|
||||
|
||||
parser->pop_block(sb);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue