From e39f4373bb0553ee6830c700d27e3afaab02d94e Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Thu, 31 Mar 2022 20:39:02 +0200 Subject: [PATCH] Fix crashes (#69, #71) --- Shared/Player/PlaybackBar.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Shared/Player/PlaybackBar.swift b/Shared/Player/PlaybackBar.swift index 56502ca5..589f348c 100644 --- a/Shared/Player/PlaybackBar.swift +++ b/Shared/Player/PlaybackBar.swift @@ -103,7 +103,11 @@ struct PlaybackBar: View { return "loading..." } - let videoLengthAtRate = player.currentVideo!.length / Double(player.currentRate) + guard let video = player.currentVideo else { + return "" + } + + let videoLengthAtRate = video.length / Double(player.currentRate) let remainingSeconds = videoLengthAtRate - player.time!.seconds if remainingSeconds < 60 {