fix: fix potential underflow
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
This commit is contained in:
parent
ed66e7e104
commit
49c7844a6e
1 changed files with 1 additions and 1 deletions
|
@ -93,7 +93,7 @@ impl menu::Item for CompletionItem {
|
||||||
}) => value,
|
}) => value,
|
||||||
};
|
};
|
||||||
// LSPs which send Color completion items include a 6 digit hex code at the end for the color. The extra 1 digit is for the '#'
|
// LSPs which send Color completion items include a 6 digit hex code at the end for the color. The extra 1 digit is for the '#'
|
||||||
text.get(text.len() - 7..)
|
text.get(text.len().checked_sub(7)?..)
|
||||||
})
|
})
|
||||||
.and_then(Color::from_hex)
|
.and_then(Color::from_hex)
|
||||||
.map_or("color".into(), |color| {
|
.map_or("color".into(), |color| {
|
||||||
|
|
Loading…
Reference in a new issue