FreeTube
FreeTube copied to clipboard
Fix blocking error when navigating away from an age-restricted video
Fix blocking error when navigating away from an age-restricted video
Pull Request Type
- [x] Bugfix
Related issue
closes #5319
Description
handleRouteChange assumes there is always a player available, which causes problems when you try to navigate away from an age-restricted video with Show family friendly content only enabled, as we don't create a player in that situation. That caused an error to get thrown, which in turn meant that the next function was not getting called in the beforeRouteLeave hook, making it impossible to navigate away from the watch page.
Testing
- Turn on
Show family friendly content onlyin the parental controls settings - Open an age-restricted video (e.g. one from here: https://www.youtube.com/playlist?list=PLSSgDEhQJbsLBwXECx1gisvaB8M2wtY9b)
- Make sure the age-restricted message is shown
- Try navigating away from the watch page e.g. back button or by clicking one of the navigation buttons on the side bar
- The navigation should work.
Desktop
- OS: Windows
- OS Version: 10
- FreeTube version: 0.21.0
Got more errors when visiting a video
Fixed the watch history and playlist code too now.