From 8fcdfa744a6d7c482b7eac27766e70077426389a Mon Sep 17 00:00:00 2001 From: Zed Date: Mon, 7 Oct 2019 15:52:44 +0200 Subject: [PATCH] Fix crash when generating RSS for invalid user --- src/routes/rss.nim | 3 ++- src/views/rss.nimf | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/routes/rss.nim b/src/routes/rss.nim index f82e3a0..30dcd28 100644 --- a/src/routes/rss.nim +++ b/src/routes/rss.nim @@ -10,7 +10,8 @@ include "../views/rss.nimf" proc showRss*(name: string; query: Query): Future[string] {.async.} = let (profile, timeline, _) = await fetchSingleTimeline(name, "", getAgent(), query) - return renderTimelineRss(timeline.content, profile) + if timeline != nil: + return renderTimelineRss(timeline, profile) template respRss*(rss: typed) = if rss.len == 0: diff --git a/src/views/rss.nimf b/src/views/rss.nimf index 717dcef..72ee5f8 100644 --- a/src/views/rss.nimf +++ b/src/views/rss.nimf @@ -57,7 +57,7 @@ #end for #end proc # -#proc renderTimelineRss*(tweets: seq[Tweet]; profile: Profile): string = +#proc renderTimelineRss*(timeline: Timeline; profile: Profile): string = #let prefs = Prefs(replaceTwitter: hostname) #result = "" @@ -76,7 +76,9 @@ 128 128 - ${renderRssTweets(tweets, prefs)} + #if timeline != nil: + ${renderRssTweets(timeline.content, prefs)} + #end if #end proc