From: Simon Tatham Date: Sun, 31 Dec 2023 13:25:07 +0000 (+0000) Subject: Replace an assert with sensible handling. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ian/git?a=commitdiff_plain;h=e3a809ffd8b658b3ed8221a5120dd015058061b8;p=mastodonochrome.git Replace an assert with sensible handling. It came up the first time I tried to test on a dev instance. --- diff --git a/src/client.rs b/src/client.rs index 6a366c2..da6fdd5 100644 --- a/src/client.rs +++ b/src/client.rs @@ -325,8 +325,15 @@ impl Client { return Ok(false); } } else { - assert!(self.feeds.contains_key(id), - "Shouldn't be extending a feed we've never fetched") + if !self.feeds.contains_key(id) { + // We might be called on to extend a feed that we've + // not yet fetched for the first time, if a streaming + // notification comes in before the user has yet taken + // us into the activity reading that feed. If so, + // ignore the event; the _actual_ initial fetch will + // deal with it later. + return Ok(false); + } } let req = match id {