mirror of
https://github.com/fish-shell/fish-shell
synced 2024-11-10 07:04:29 +00:00
fish_indent: Another crash
NUL at the end, which is now ignored. Not *great*, but better than crashing.
This commit is contained in:
parent
50acc4f4de
commit
2e14c32c5e
2 changed files with 5 additions and 2 deletions
|
@ -647,11 +647,11 @@ impl<'source, 'ast> PrettyPrinterState<'source, 'ast> {
|
|||
// # something
|
||||
// cmd2
|
||||
// Treat it as gap text.
|
||||
if node.range().unwrap().length() == 0 {
|
||||
let Some(range) = node.range() else { return; };
|
||||
if range.length() == 0 {
|
||||
return;
|
||||
}
|
||||
let flags = self.gap_text_flags_before_node(node);
|
||||
let range = node.range().unwrap();
|
||||
self.current_indent = self.indent(range.start());
|
||||
let added_newline = self.emit_gap_text_before(range, flags);
|
||||
let mut gap_range = range;
|
||||
|
|
|
@ -446,3 +446,6 @@ echo b\|\{ | $fish_indent
|
|||
|
||||
echo "\'\\\\\x00\'" | string unescape | $fish_indent | string escape
|
||||
# CHECK: \'\\\x00\'
|
||||
|
||||
echo '\"\"\|\x00' | string unescape | $fish_indent | string unescape
|
||||
# CHECK: |
|
||||
|
|
Loading…
Reference in a new issue