mirror of
https://github.com/wez/wezterm.git
synced 2024-12-23 13:21:38 +03:00
fix potential panic when computing hyperlink rules
refs: https://github.com/wez/wezterm/issues/2355
This commit is contained in:
parent
7d01d3f683
commit
9cce9ff81b
@ -499,6 +499,10 @@ impl Line {
|
||||
|
||||
pub fn split_off(&mut self, idx: usize, seqno: SequenceNo) -> Self {
|
||||
let my_cells = self.coerce_vec_storage();
|
||||
// Clamp to avoid out of bounds panic if the line is shorter
|
||||
// than the requested split point
|
||||
// <https://github.com/wez/wezterm/issues/2355>
|
||||
let idx = idx.min(my_cells.len());
|
||||
let cells = my_cells.split_off(idx);
|
||||
Self {
|
||||
bits: self.bits,
|
||||
|
Loading…
Reference in New Issue
Block a user