From b5c9a706cec60274e6df17a1c1bc61f5f3dc82c7 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Fri, 13 Dec 2019 12:10:04 +0100 Subject: [PATCH] fix cancellable future Signed-off-by: Wolfgang Bumiller --- src/tools/futures.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/futures.rs b/src/tools/futures.rs index 30d7b7cf..893fd28d 100644 --- a/src/tools/futures.rs +++ b/src/tools/futures.rs @@ -61,7 +61,9 @@ impl Canceller { /// /// This does nothing if the future already finished successfully. pub fn cancel(&self) { - let _ = self.0.lock().unwrap().take().unwrap().send(()); + if let Some(sender) = self.0.lock().unwrap().take() { + let _ = sender.send(()); + } } }