Skip to content

Commit

Permalink
Fix external player not opening on Subscriptions page (#3172)
Browse files Browse the repository at this point in the history
* Changed undefined to null

If playlistId is set to undefined it will break /src/renderer/store/modules/utils.js:openInExternalPlayer() as it expects null or string. Undefined makes it believe it is a playlist and ignores the videoId

* revert last commit

* Added tests for undefined in openInExternalPlayer()
  • Loading branch information
ArturWagnerBusiness authored Feb 9, 2023
1 parent 17831b3 commit 38fe74a
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/renderer/store/modules/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ const actions = {
}
}

if (payload.playbackRate !== null) {
if (payload.playbackRate != null) {
if (typeof cmdArgs.playbackRate === 'string') {
args.push(`${cmdArgs.playbackRate}${payload.playbackRate}`)
} else if (!ignoreWarnings) {
Expand All @@ -516,8 +516,8 @@ const actions = {
}

// Check whether the video is in a playlist
if (typeof cmdArgs.playlistUrl === 'string' && payload.playlistId !== null && payload.playlistId !== '') {
if (payload.playlistIndex !== null) {
if (typeof cmdArgs.playlistUrl === 'string' && payload.playlistId != null && payload.playlistId !== '') {
if (payload.playlistIndex != null) {
if (typeof cmdArgs.playlistIndex === 'string') {
args.push(`${cmdArgs.playlistIndex}${payload.playlistIndex}`)
} else if (!ignoreWarnings) {
Expand Down Expand Up @@ -554,10 +554,10 @@ const actions = {
args.push(`${cmdArgs.playlistUrl}https://youtube.com/playlist?list=${payload.playlistId}`)
}
} else {
if (payload.playlistId !== null && payload.playlistId !== '' && !ignoreWarnings) {
if (payload.playlistId != null && payload.playlistId !== '' && !ignoreWarnings) {
showExternalPlayerUnsupportedActionToast(externalPlayer, 'opening playlists')
}
if (payload.videoId !== null) {
if (payload.videoId != null) {
if (cmdArgs.supportsYtdlProtocol) {
args.push(`${cmdArgs.videoUrl}ytdl://${payload.videoId}`)
} else {
Expand All @@ -566,9 +566,9 @@ const actions = {
}
}

const videoOrPlaylist = payload.playlistId === null || payload.playlistId === ''
? i18n.t('Video.External Player.video')
: i18n.t('Video.External Player.playlist')
const videoOrPlaylist = payload.playlistId != null && payload.playlistId !== ''
? i18n.t('Video.External Player.playlist')
: i18n.t('Video.External Player.video')

showToast(i18n.t('Video.External Player.OpeningTemplate', { videoOrPlaylist, externalPlayer }))

Expand Down

0 comments on commit 38fe74a

Please sign in to comment.