瀏覽代碼

[fix] Handle the case when no "sibling" article exist in the storage

jherve 1 年之前
父節點
當前提交
7e74f488c9
共有 1 個文件被更改,包括 1 次插入0 次删除
  1. 1 0
      src/de_quoi_parle_le_monde/web.py

+ 1 - 0
src/de_quoi_parle_le_monde/web.py

@@ -41,6 +41,7 @@ async def site_main_article_snapshot(
         return min(
             [a for a in after_before_articles if cond_fun(a)],
             key=lambda a: abs(a["time_diff"]),
+            default=None,
         )
 
     main_articles = await storage.list_neighbouring_main_articles(id, snapshot_id)