on master help sign in
fail if doc save sender is closed
commit759d55cc81da10c93f6cbfcbe605806b9dc37d2f authorSkyler Hawthorne <skyler@dead10ck.com> dateSun 16 Oct 2022, 22:41 (4 years ago) parente645804
1 file changed+5−3
helix-view/src/editor.rs+5−3
helix-view/src/editor.rs+5−3
@@ -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