diff options
author | Kevin Ballard <kevin@sb.org> | 2014-09-02 14:49:17 -0700 |
---|---|---|
committer | Kevin Ballard <kevin@sb.org> | 2014-09-02 15:30:51 -0700 |
commit | 1d9886d0f73250eae2a4b8e7e0a5793597d1c8a7 (patch) | |
tree | 9dc366701cd6f658410bd3665bd2d15971d24ea7 /complete.cpp | |
parent | 1d0279eac5f37fd4ec453b0151274ab3300da817 (diff) |
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.
Diffstat (limited to 'complete.cpp')
-rw-r--r-- | complete.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/complete.cpp b/complete.cpp index 71df3e98..8ede1eb2 100644 --- a/complete.cpp +++ b/complete.cpp @@ -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();) { 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, L"remove option -%lc --%ls\n", |