mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-03-11 21:27:05 +00:00
fix: useVideo check current before destroying
This commit is contained in:
parent
536be36005
commit
b876c920fc
1 changed files with 9 additions and 1 deletions
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Reference in a new issue