mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-20 02:47:34 +03:00
Don't insert an empty vector in Project::buffer_snapshots
Other code paths rely on at least a version always being there, so we should enforce that invariant everywhere.
This commit is contained in:
parent
663beab1b9
commit
c994263225
@ -1216,7 +1216,7 @@ impl Project {
|
|||||||
let file = File::from_dyn(buffer.file())?;
|
let file = File::from_dyn(buffer.file())?;
|
||||||
let abs_path = file.as_local()?.abs_path(cx);
|
let abs_path = file.as_local()?.abs_path(cx);
|
||||||
let uri = lsp::Url::from_file_path(abs_path).unwrap();
|
let uri = lsp::Url::from_file_path(abs_path).unwrap();
|
||||||
let buffer_snapshots = self.buffer_snapshots.entry(buffer.remote_id()).or_default();
|
let buffer_snapshots = self.buffer_snapshots.get_mut(&buffer.remote_id())?;
|
||||||
let (version, prev_snapshot) = buffer_snapshots.last()?;
|
let (version, prev_snapshot) = buffer_snapshots.last()?;
|
||||||
let next_snapshot = buffer.text_snapshot();
|
let next_snapshot = buffer.text_snapshot();
|
||||||
let next_version = version + 1;
|
let next_version = version + 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user