From 6d384a8691553b59fdb04361eadbf3612efded58 Mon Sep 17 00:00:00 2001 From: Brandon-T Date: Tue, 26 Sep 2023 23:52:23 -0400 Subject: [PATCH] Fix brave/brave-ios#8013: Fix Playlist Crash on iPad due to invalid Scene (brave/brave-ios#8162) --- .../Playlist/Controllers/PlaylistListViewController.swift | 2 +- .../Browser/Playlist/Managers & Cache/PlaylistCacheLoader.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/Brave/Frontend/Browser/Playlist/Controllers/PlaylistListViewController.swift b/Sources/Brave/Frontend/Browser/Playlist/Controllers/PlaylistListViewController.swift index 04c0501270d9..998a3dc8684b 100644 --- a/Sources/Brave/Frontend/Browser/Playlist/Controllers/PlaylistListViewController.swift +++ b/Sources/Brave/Frontend/Browser/Playlist/Controllers/PlaylistListViewController.swift @@ -704,7 +704,7 @@ extension PlaylistListViewController { } } - let items = try await PlaylistSharedFolderNetwork.fetchMediaItemInfo(item: model, viewForInvisibleWebView: self.view) + let items = try await PlaylistSharedFolderNetwork.fetchMediaItemInfo(item: model, viewForInvisibleWebView: self.playerView.window ?? self.playerView.superview ?? self.playerView) try Task.checkCancellation() try folder.playlistItems?.forEach({ playlistItem in diff --git a/Sources/Brave/Frontend/Browser/Playlist/Managers & Cache/PlaylistCacheLoader.swift b/Sources/Brave/Frontend/Browser/Playlist/Managers & Cache/PlaylistCacheLoader.swift index 929a472cfe17..9198c18e382a 100644 --- a/Sources/Brave/Frontend/Browser/Playlist/Managers & Cache/PlaylistCacheLoader.swift +++ b/Sources/Brave/Frontend/Browser/Playlist/Managers & Cache/PlaylistCacheLoader.swift @@ -340,7 +340,7 @@ class PlaylistWebLoader: UIView { guard let webView = tab.webView, let browserViewController = self.currentScene?.browserViewController else { - continuation.resume(returning: nil) + self.handler?(nil) return }