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
1 changed files with 4 additions and 2 deletions
|
@ -867,10 +867,12 @@ fn compare_diagnostics(
|
||||||
snapshot: &language::BufferSnapshot,
|
snapshot: &language::BufferSnapshot,
|
||||||
) -> Ordering {
|
) -> Ordering {
|
||||||
use language::ToOffset;
|
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;
|
return Ordering::Greater;
|
||||||
}
|
}
|
||||||
|
|
||||||
old.range
|
old.range
|
||||||
.start
|
.start
|
||||||
.to_offset(snapshot)
|
.to_offset(snapshot)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue