Skip to content

Commit

Permalink
Crash sooner on invalid background highlights (#7702)
Browse files Browse the repository at this point in the history
Release Notes:

- N/A
  • Loading branch information
ConradIrwin authored Feb 12, 2024
1 parent ede9600 commit d13a731
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions crates/editor/src/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8505,6 +8505,17 @@ impl Editor {
color_fetcher: fn(&ThemeColors) -> Hsla,
cx: &mut ViewContext<Self>,
) {
let snapshot = self.snapshot(cx);
// this is to try and catch a panic sooner
for range in &ranges {
snapshot
.buffer_snapshot
.summary_for_anchor::<usize>(&range.start);
snapshot
.buffer_snapshot
.summary_for_anchor::<usize>(&range.end);
}

self.background_highlights
.insert(TypeId::of::<T>(), (color_fetcher, ranges));
cx.notify();
Expand Down

0 comments on commit d13a731

Please sign in to comment.