Merge pull request #1057 from Stremio/fix/trailer-player-crashes
Some checks failed
Build / build (push) Has been cancelled

Player: prevent crash when destroying null video
This commit is contained in:
Timothy Z. 2025-11-07 12:52:35 +02:00 committed by GitHub
commit c3f1f6c911
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -152,7 +152,15 @@ const useVideo = () => {
video.current.on('extraSubtitlesTrackLoaded', onExtraSubtitlesTrackLoaded);
video.current.on('extraSubtitlesTrackAdded', onExtraSubtitlesTrackAdded);
return () => video.current.destroy();
return () => {
if (video.current) {
try {
video.current.destroy();
} catch (err) {
console.error('Error destroying video:', err);
}
}
};
}, []);
return {