Don't crash when setting fish_history before reader is initialized

Not crashing is just soo much nicer.

Fixes #4619.
This commit is contained in:
Fabian Homborg 2018-01-01 13:00:00 +01:00
parent 585321181d
commit 75ac482cec

View file

@ -1962,8 +1962,11 @@ static parser_test_error_bits_t default_test(const wchar_t *b) {
}
void reader_change_history(const wchar_t *name) {
data->history->save();
data->history = &history_t::history_with_name(name);
// We don't need to _change_ if we're not initialized yet.
if (data && data->history) {
data->history->save();
data->history = &history_t::history_with_name(name);
}
}
void reader_push(const wchar_t *name) {