From 0515ed976cb36e24b845d5897c16c602fc8ea813 Mon Sep 17 00:00:00 2001 From: Jonathan Turner Date: Mon, 9 Dec 2019 05:36:24 +1300 Subject: [PATCH] Fix panic --- src/shell/completer.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shell/completer.rs b/src/shell/completer.rs index c40b67d86..fac2af1c4 100644 --- a/src/shell/completer.rs +++ b/src/shell/completer.rs @@ -32,7 +32,7 @@ impl NuCompleter { let mut completions; // 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); } else { completions = self.file_completer.complete(line, pos, context)?.1;