mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
Assert value of tok_begin
after call to parse_util_token_extent
We later assign the value of `tok_begin` to a `wcstring` which would cause a null dereference if `tok_begin` were still null.
This commit is contained in:
parent
fbc6c68f3d
commit
6108b1d813
1 changed files with 2 additions and 1 deletions
|
@ -1264,8 +1264,9 @@ void complete(const wcstring &cmd_with_subcmds, std::vector<completion_t> *out_c
|
|||
// debug( 1, L"Complete '%ls'", cmd.c_str() );
|
||||
|
||||
const wchar_t *cmd_cstr = cmd.c_str();
|
||||
const wchar_t *tok_begin = NULL, *prev_begin = NULL, *prev_end = NULL;
|
||||
const wchar_t *tok_begin = nullptr, *prev_begin = nullptr, *prev_end = nullptr;
|
||||
parse_util_token_extent(cmd_cstr, cmd.size(), &tok_begin, NULL, &prev_begin, &prev_end);
|
||||
assert(tok_begin != nullptr);
|
||||
|
||||
// If we are completing a variable name or a tilde expansion user name, we do that and return.
|
||||
// No need for any other completions.
|
||||
|
|
Loading…
Reference in a new issue