mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-19 02:17:35 +03:00
Validate buffer_id of anchors in is_valid (#11170)
Release Notes: - Fixes diagnostic panic better (follow up from #11066)
This commit is contained in:
parent
95118c6568
commit
5674ba2a49
@ -97,6 +97,8 @@ impl Anchor {
|
|||||||
pub fn is_valid(&self, buffer: &BufferSnapshot) -> bool {
|
pub fn is_valid(&self, buffer: &BufferSnapshot) -> bool {
|
||||||
if *self == Anchor::MIN || *self == Anchor::MAX {
|
if *self == Anchor::MIN || *self == Anchor::MAX {
|
||||||
true
|
true
|
||||||
|
} else if self.buffer_id != Some(buffer.remote_id) {
|
||||||
|
false
|
||||||
} else {
|
} else {
|
||||||
let fragment_id = buffer.fragment_id_for_anchor(self);
|
let fragment_id = buffer.fragment_id_for_anchor(self);
|
||||||
let mut fragment_cursor = buffer.fragments.cursor::<(Option<&Locator>, usize)>();
|
let mut fragment_cursor = buffer.fragments.cursor::<(Option<&Locator>, usize)>();
|
||||||
|
Loading…
Reference in New Issue
Block a user