From c9a3a6ecb70f7e158d836e4fd0614ea003b74a62 Mon Sep 17 00:00:00 2001 From: Cay Zhang <13341339+Cay-Zhang@users.noreply.github.com> Date: Mon, 27 Nov 2023 21:10:14 -0600 Subject: [PATCH] Fix error when to view list is empty --- BilibiliLive/Module/Personal/ToViewViewController.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BilibiliLive/Module/Personal/ToViewViewController.swift b/BilibiliLive/Module/Personal/ToViewViewController.swift index 73796a06..bf7af5e7 100644 --- a/BilibiliLive/Module/Personal/ToViewViewController.swift +++ b/BilibiliLive/Module/Personal/ToViewViewController.swift @@ -88,9 +88,9 @@ struct ToViewData: PlayableData, Codable { extension WebRequest { static func requestToView() async throws -> [ToViewData] { struct Resp: Codable { - var list: [ToViewData] + var list: [ToViewData]? } let res: Resp = try await request(url: "https://api.bilibili.com/x/v2/history/toview") - return res.list + return res.list ?? [] } }