mirror of
https://github.com/yattee/yattee.git
synced 2025-11-16 06:58:43 +00:00
Add nil safety checks for stream resolution handling
Added comprehensive nil checks for stream resolution values across PlayerBackend, QualityProfile, and PlayerQueue to prevent crashes when streams have missing resolution metadata. Also added backend nil checks in PlayerQueue.
This commit is contained in:
@@ -76,8 +76,13 @@ struct QualityProfile: Hashable, Identifiable, Defaults.Serializable {
|
||||
return true
|
||||
}
|
||||
|
||||
// Safety check: Ensure stream has a resolution
|
||||
guard let streamResolution = stream.resolution else {
|
||||
return false
|
||||
}
|
||||
|
||||
let defaultResolution = Stream.Resolution.custom(height: 720, refreshRate: 30)
|
||||
let resolutionMatch = resolution.value ?? defaultResolution >= stream.resolution
|
||||
let resolutionMatch = resolution.value ?? defaultResolution >= streamResolution
|
||||
|
||||
if resolutionMatch, formats.contains(.stream), stream.kind == .stream {
|
||||
return true
|
||||
|
||||
Reference in New Issue
Block a user