From fa15a18374e67e6fddbd28f7b05fe009eaa717b6 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Thu, 17 Nov 2022 22:48:43 +0100 Subject: [PATCH] Fix possible crash --- Model/Player/PlayerModel.swift | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Model/Player/PlayerModel.swift b/Model/Player/PlayerModel.swift index 4c9202c5..8ce6adc6 100644 --- a/Model/Player/PlayerModel.swift +++ b/Model/Player/PlayerModel.swift @@ -445,14 +445,16 @@ final class PlayerModel: ObservableObject { changeActiveBackend(from: activeBackend, to: backend) } - guard let stream = ((availableStreams.count == 1 && availableStreams.first!.isLocal) ? availableStreams.first : nil) ?? streamByQualityProfile else { + guard let stream = (((availableStreams.count == 1 && availableStreams.first!.isLocal) ? availableStreams.first : nil) ?? streamByQualityProfile), + let currentVideo + else { return } streamSelection = stream playStream( stream, - of: currentVideo!, + of: currentVideo, preservingTime: !currentItem.playbackTime.isNil ) }