mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-02-01 17:26:13 +08:00
reader: Fix crash when text is empty after stripping spaces
This crashed on Fedora with the rpm packages, but not when building from source, so some compiler option triggers it. But the root cause is us running `text.front()` on an empty string, which isn't something you should do. Fixes #8009.
This commit is contained in:
parent
31f3c16857
commit
a427bf207a
|
@ -3274,9 +3274,8 @@ void reader_data_t::handle_readline_command(readline_cmd_t c, readline_loop_stat
|
|||
text.pop_back();
|
||||
}
|
||||
|
||||
if (history && !conf.in_silent_mode) {
|
||||
if (!text.empty() && history && !conf.in_silent_mode) {
|
||||
// Remove ephemeral items.
|
||||
// Note we fall into this case if the user just types a space and hits return.
|
||||
history->remove_ephemeral_items();
|
||||
|
||||
// Mark this item as ephemeral if there is a leading space (#615).
|
||||
|
|
Loading…
Reference in New Issue
Block a user