From 759d55cc81da10c93f6cbfcbe605806b9dc37d2f Mon Sep 17 00:00:00 2001 From: Skyler Hawthorne Date: Sun, 16 Oct 2022 22:41:01 -0400 Subject: fail if doc save sender is closed --- helix-view/src/editor.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) 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))?; -- cgit v1.2.3-70-g09d2