Fix nil crash when accessing stream.format

This commit addresses crashes caused by accessing nil format values on streams:

- QualityProfile.swift: Add guard check for stream.format to prevent nil access crash
- MPVBackend.swift: Add nil check in canPlay method before comparing format
- PlayerStreams.swift: Add nil check before comparing format in asset processing

The crashes occurred when stream.format was nil and accessed as an implicitly unwrapped optional, causing "Unexpectedly found nil while implicitly unwrapping an Optional value" errors.
This commit is contained in:
Arkadiusz Fal
2025-11-19 18:03:43 +01:00
parent 4b577a296b
commit 33377f7e0e
3 changed files with 8 additions and 3 deletions

View File

@@ -220,7 +220,7 @@ final class MPVBackend: PlayerBackend {
typealias AreInIncreasingOrder = (Stream, Stream) -> Bool
func canPlay(_ stream: Stream) -> Bool {
stream.format != .av1
stream.format != nil && stream.format != .av1
}
func playStream(_ stream: Stream, of video: Video, preservingTime: Bool, upgrading: Bool) {