Fix panic

This commit is contained in:
Jonathan Turner 2019-12-09 05:36:24 +13:00
parent f653992b4a
commit 0515ed976c

View File

@ -32,7 +32,7 @@ impl NuCompleter {
let mut completions; let mut completions;
// See if we're a flag // See if we're a flag
if pos > 0 && line_chars[replace_pos] == '-' { if pos > 0 && replace_pos < line_chars.len() && line_chars[replace_pos] == '-' {
completions = self.get_matching_arguments(&line_chars, line, replace_pos, pos); completions = self.get_matching_arguments(&line_chars, line, replace_pos, pos);
} else { } else {
completions = self.file_completer.complete(line, pos, context)?.1; completions = self.file_completer.complete(line, pos, context)?.1;