diff options
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/event.rs | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/core/src/event.rs b/core/src/event.rs index 876fda5..a32677b 100644 --- a/core/src/event.rs +++ b/core/src/event.rs @@ -243,9 +243,9 @@ where /// Cancels the listener and removes it from the `EventSys`. pub async fn cancel(&self) { - self.event_sys() - .remove(&self.topic, &self.event_id, &self.id) - .await; + if let Some(es) = self.event_sys.upgrade() { + es.remove(&self.topic, &self.event_id, &self.id).await; + } } /// Returns the topic for this event listener. @@ -257,10 +257,6 @@ where pub async fn event_id(&self) -> &String { &self.event_id } - - fn event_sys(&self) -> ArcEventSys<T> { - self.event_sys.upgrade().unwrap() - } } /// An event within the [`EventSys`]. |