mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-26 18:03:02 +03:00
Check validity of new.range too (#12781)
I'm not certain yet how it could be invalid, but we are still seeing panics here. Release Notes: - Fixed a panic when opening the diagnostics view
This commit is contained in:
parent
834089feb1
commit
6fa6e0718c
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user