editor: Fix may crash on render indent guides. (#1619)

This commit is contained in:
Jason Lee 2025-11-17 11:17:06 +08:00 committed by GitHub
parent 672a80dcd8
commit 0a5c799aba
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -124,7 +124,10 @@ impl TextElement {
let mut last_indents = vec![]; let mut last_indents = vec![];
for ix in visible_range { for ix in visible_range {
let line = state.text.slice_line(ix); let line = state.text.slice_line(ix);
let line_layout = last_layout.line(ix).expect("line layout should exist"); let Some(line_layout) = last_layout.line(ix) else {
continue;
};
let mut current_indents = vec![]; let mut current_indents = vec![];
if line.len() > 0 { if line.len() > 0 {
let indent_count = tab_size.indent_count(&line); let indent_count = tab_size.indent_count(&line);