1
1
mirror of https://github.com/wez/wezterm.git synced 2024-09-21 19:58:15 +03:00

gui: quickselect: instrument and avoid potential panic

The label dedup code has panicked on me a couple of times.
I managed to capture the line number, so this commit aims to
capture some state to try to understand what's going on,
and importantly, to avoid the actual panic part.

refs: #1271
This commit is contained in:
Wez Furlong 2021-12-23 08:55:36 -07:00
parent 0a93a58605
commit becd107600

View File

@ -549,7 +549,21 @@ impl QuickSelectRenderable {
idx
}
};
let label = &labels[label_index];
let label = match labels.get(label_index) {
Some(l) => l,
None => {
log::error!("match_id {} has label_index {} which is out of \
bounds of the number of labels {} produced for {} \
unique results",
res.match_id, label_index,
labels.len(),
uniq_results.len());
log::error!("labels = {:?}", labels);
log::error!("uniq_results = {:?}", uniq_results);
log::error!("res = {:?}", res);
continue;
}
};
self.by_label.insert(label.clone(), result_index);
for idx in res.start_y..=res.end_y {