Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Check validity of new.range too (#12781)

Conrad Irwin6fa6e0718cf8
diff --git a/crates/diagnostics/src/diagnostics.rs b/crates/diagnostics/src/diagnostics.rs
index 4d816297232..4b8c943dd09 100644
--- a/crates/diagnostics/src/diagnostics.rs
+++ b/crates/diagnostics/src/diagnostics.rs
@@ -867,10 +867,12 @@ fn compare_diagnostics(
snapshot: &language::BufferSnapshot,
) -> Ordering {
use language::ToOffset;
- // The old diagnostics may point to a previously open Buffer for this file.
- if !old.range.start.is_valid(snapshot) {
+
+ // The diagnostics may point to a previously open Buffer for this file.
+ if !old.range.start.is_valid(snapshot) || !new.range.start.is_valid(snapshot) {
return Ordering::Greater;
}
+
old.range
.start
.to_offset(snapshot)