mirror of
https://github.com/yattee/yattee.git
synced 2025-11-16 15:08:43 +00:00
Add nil safety check for currentTime in MPVBackend
Added guard check to return early if currentTime is nil in getTimeUpdates. Simplified optional unwrapping by using the guarded currentTime value throughout the method.
This commit is contained in:
@@ -498,6 +498,10 @@ final class MPVBackend: PlayerBackend {
|
||||
currentTime = client?.currentTime
|
||||
playerItemDuration = client?.duration
|
||||
|
||||
guard let currentTime else {
|
||||
return
|
||||
}
|
||||
|
||||
if controlsUpdates {
|
||||
updateControls()
|
||||
}
|
||||
@@ -505,16 +509,14 @@ final class MPVBackend: PlayerBackend {
|
||||
model.updateNowPlayingInfo()
|
||||
|
||||
handleSegmentsThrottle.execute {
|
||||
if let currentTime {
|
||||
model.handleSegments(at: currentTime)
|
||||
}
|
||||
model.handleSegments(at: currentTime)
|
||||
}
|
||||
|
||||
timeObserverThrottle.execute {
|
||||
self.model.updateWatch(time: self.currentTime)
|
||||
self.model.updateWatch(time: currentTime)
|
||||
}
|
||||
|
||||
self.model.updateTime(self.currentTime!)
|
||||
self.model.updateTime(currentTime)
|
||||
}
|
||||
|
||||
private func stopClientUpdates() {
|
||||
|
||||
Reference in New Issue
Block a user