Skip to content

Commit 80a9b3c

Browse files
committed
fail if doc save sender is closed
1 parent 9c202c1 commit 80a9b3c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

helix-view/src/editor.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1202,10 +1202,12 @@ impl Editor {
12021202
let path = path.map(|path| path.into());
12031203
let doc = doc_mut!(self, &doc_id);
12041204
let future = doc.save(path, force)?;
1205-
// TODO: if no self.saves for that doc id then bail
1206-
// bail!("saves are closed for this document!");
1205+
12071206
use futures_util::stream;
1208-
self.saves[&doc_id]
1207+
1208+
self.saves
1209+
.get(&doc_id)
1210+
.ok_or_else(|| anyhow::format_err!("saves are closed for this document!"))?
12091211
.send(stream::once(Box::pin(future)))
12101212
.map_err(|err| anyhow!("failed to send save event: {}", err))?;
12111213

0 commit comments

Comments
 (0)