From a83657b8c6a67ba04be1e119553aa52ffa4b8d5d Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Sun, 7 May 2023 21:54:48 +0200 Subject: [PATCH] Fix crash --- Model/Player/Backends/MPVBackend.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Model/Player/Backends/MPVBackend.swift b/Model/Player/Backends/MPVBackend.swift index cc7490e0..7954a83f 100644 --- a/Model/Player/Backends/MPVBackend.swift +++ b/Model/Player/Backends/MPVBackend.swift @@ -280,7 +280,7 @@ final class MPVBackend: PlayerBackend { self.stop() DispatchQueue.main.async { [weak self] in - guard let self else { + guard let self, let client = self.client else { return } @@ -296,7 +296,7 @@ final class MPVBackend: PlayerBackend { } } - self.client.loadFile(url, sub: captions?.url, time: time, forceSeekable: stream.kind == .hls) { [weak self] _ in + client.loadFile(url, sub: captions?.url, time: time, forceSeekable: stream.kind == .hls) { [weak self] _ in self?.isLoadingVideo = true } } else { @@ -308,7 +308,7 @@ final class MPVBackend: PlayerBackend { let fileToLoad = self.model.musicMode ? stream.audioAsset.url : stream.videoAsset.url let audioTrack = self.model.musicMode ? nil : stream.audioAsset.url - self.client?.loadFile(fileToLoad, audio: audioTrack, sub: captions?.url, time: time, forceSeekable: stream.kind == .hls) { [weak self] _ in + client.loadFile(fileToLoad, audio: audioTrack, sub: captions?.url, time: time, forceSeekable: stream.kind == .hls) { [weak self] _ in self?.isLoadingVideo = true self?.pause() }