Check that parser is not nullptr before calling libdata.

Avoids a possible nullptr dereference in
parse_execution_context_t::check_end_execution
This commit is contained in:
Lior Stern 2020-03-31 18:25:22 +03:00 committed by ridiculousfish
parent 1b23e5471d
commit 321e1ed26a

View File

@ -189,7 +189,10 @@ maybe_t<end_execution_reason_t> parse_execution_context_t::check_end_execution()
if (shell_is_exiting()) {
return end_execution_reason_t::cancelled;
}
if (parser && parser->cancellation_signal) {
if (nullptr == parser) {
return none();
}
if (parser->cancellation_signal) {
return end_execution_reason_t::cancelled;
}
const auto &ld = parser->libdata();