mirror of
https://github.com/zed-industries/zed.git
synced 2024-12-27 19:02:07 +00:00
Avoid panicking when receiving a request for a dropped buffer
This commit is contained in:
parent
3daaef02ca
commit
663beab1b9
1 changed files with 7 additions and 7 deletions
|
@ -3850,7 +3850,7 @@ impl Project {
|
|||
let buffer = this
|
||||
.opened_buffers
|
||||
.get(&buffer_id)
|
||||
.map(|buffer| buffer.upgrade(cx).unwrap())
|
||||
.and_then(|buffer| buffer.upgrade(cx))
|
||||
.ok_or_else(|| anyhow!("unknown buffer id {}", buffer_id))?;
|
||||
Ok::<_, anyhow::Error>((project_id, buffer))
|
||||
})?;
|
||||
|
@ -3882,7 +3882,7 @@ impl Project {
|
|||
buffers.insert(
|
||||
this.opened_buffers
|
||||
.get(buffer_id)
|
||||
.map(|buffer| buffer.upgrade(cx).unwrap())
|
||||
.and_then(|buffer| buffer.upgrade(cx))
|
||||
.ok_or_else(|| anyhow!("unknown buffer id {}", buffer_id))?,
|
||||
);
|
||||
}
|
||||
|
@ -3911,7 +3911,7 @@ impl Project {
|
|||
buffers.insert(
|
||||
this.opened_buffers
|
||||
.get(buffer_id)
|
||||
.map(|buffer| buffer.upgrade(cx).unwrap())
|
||||
.and_then(|buffer| buffer.upgrade(cx))
|
||||
.ok_or_else(|| anyhow!("unknown buffer id {}", buffer_id))?,
|
||||
);
|
||||
}
|
||||
|
@ -3942,7 +3942,7 @@ impl Project {
|
|||
let buffer = this.read_with(&cx, |this, cx| {
|
||||
this.opened_buffers
|
||||
.get(&envelope.payload.buffer_id)
|
||||
.map(|buffer| buffer.upgrade(cx).unwrap())
|
||||
.and_then(|buffer| buffer.upgrade(cx))
|
||||
.ok_or_else(|| anyhow!("unknown buffer id {}", envelope.payload.buffer_id))
|
||||
})?;
|
||||
buffer
|
||||
|
@ -3972,7 +3972,7 @@ impl Project {
|
|||
let buffer = this
|
||||
.opened_buffers
|
||||
.get(&envelope.payload.buffer_id)
|
||||
.map(|buffer| buffer.upgrade(cx).unwrap())
|
||||
.and_then(|buffer| buffer.upgrade(cx))
|
||||
.ok_or_else(|| anyhow!("unknown buffer id {}", envelope.payload.buffer_id))?;
|
||||
let language = buffer.read(cx).language();
|
||||
let completion = language::proto::deserialize_completion(
|
||||
|
@ -4014,7 +4014,7 @@ impl Project {
|
|||
let buffer = this.update(&mut cx, |this, cx| {
|
||||
this.opened_buffers
|
||||
.get(&envelope.payload.buffer_id)
|
||||
.map(|buffer| buffer.upgrade(cx).unwrap())
|
||||
.and_then(|buffer| buffer.upgrade(cx))
|
||||
.ok_or_else(|| anyhow!("unknown buffer id {}", envelope.payload.buffer_id))
|
||||
})?;
|
||||
buffer
|
||||
|
@ -4055,7 +4055,7 @@ impl Project {
|
|||
let buffer = this
|
||||
.opened_buffers
|
||||
.get(&envelope.payload.buffer_id)
|
||||
.map(|buffer| buffer.upgrade(cx).unwrap())
|
||||
.and_then(|buffer| buffer.upgrade(cx))
|
||||
.ok_or_else(|| anyhow!("unknown buffer id {}", envelope.payload.buffer_id))?;
|
||||
Ok::<_, anyhow::Error>(this.apply_code_action(buffer, action, false, cx))
|
||||
})?;
|
||||
|
|
Loading…
Reference in a new issue