mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 13:39:02 +00:00
Don't segfault when erasing short option completions
When using `complete -s x -e`, the long option is unspecified, which makes it NULL. Comparing this to a `wcstring` segfaults. Fixes #1182.
This commit is contained in:
parent
1d0279eac5
commit
1d9886d0f7
1 changed files with 1 additions and 1 deletions
|
@ -630,7 +630,7 @@ bool completion_entry_t::remove_option(wchar_t short_opt, const wchar_t *long_op
|
||||||
for (option_list_t::iterator iter = this->options.begin(); iter != this->options.end();)
|
for (option_list_t::iterator iter = this->options.begin(); iter != this->options.end();)
|
||||||
{
|
{
|
||||||
complete_entry_opt_t &o = *iter;
|
complete_entry_opt_t &o = *iter;
|
||||||
if (short_opt==o.short_opt || long_opt == o.long_opt)
|
if (short_opt==o.short_opt || (long_opt && long_opt == o.long_opt))
|
||||||
{
|
{
|
||||||
/* fwprintf( stderr,
|
/* fwprintf( stderr,
|
||||||
L"remove option -%lc --%ls\n",
|
L"remove option -%lc --%ls\n",
|
||||||
|
|
Loading…
Reference in a new issue