diff --git a/helix-view/src/editor.rs b/helix-view/src/editor.rs index 9f74c5ec..ee84dbd3 100644 --- a/helix-view/src/editor.rs +++ b/helix-view/src/editor.rs @@ -1202,10 +1202,12 @@ impl Editor { let path = path.map(|path| path.into()); let doc = doc_mut!(self, &doc_id); let future = doc.save(path, force)?; - // TODO: if no self.saves for that doc id then bail - // bail!("saves are closed for this document!"); + use futures_util::stream; - self.saves[&doc_id] + + self.saves + .get(&doc_id) + .ok_or_else(|| anyhow::format_err!("saves are closed for this document!"))? .send(stream::once(Box::pin(future))) .map_err(|err| anyhow!("failed to send save event: {}", err))?;