From c2bb750cd0354d54a98694154e7dae035699636b Mon Sep 17 00:00:00 2001 From: higuaifan Date: Mon, 20 May 2024 09:42:04 +0800 Subject: [PATCH] refactor: replace map function with if let structure --- BilibiliLive/Component/Video/VideoDetailViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/BilibiliLive/Component/Video/VideoDetailViewController.swift b/BilibiliLive/Component/Video/VideoDetailViewController.swift index e65b96c..f9ef9a3 100644 --- a/BilibiliLive/Component/Video/VideoDetailViewController.swift +++ b/BilibiliLive/Component/Video/VideoDetailViewController.swift @@ -321,7 +321,7 @@ class VideoDetailViewController: UIViewController { if let season = data.View.ugc_season { if season.sections.count > 1 { - season.sections.first(where: { section in section.episodes.contains(where: { episode in episode.aid == data.View.aid }) }).map { section in + if let section = season.sections.first(where: { section in section.episodes.contains(where: { episode in episode.aid == data.View.aid }) }) { allUgcEpisodes = section.episodes } } else {