Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #1807 (VLC does not start) #1850

Merged
merged 2 commits into from
Jul 31, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/main/external-player.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ let proc = null
function checkInstall (playerPath, cb) {
// check for VLC if external player has not been specified by the user
// otherwise assume the player is installed
if (playerPath == null) return vlcCommand(cb)
if (playerPath.length === 0) return vlcCommand(cb)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Won't this throw a TypeError when playerPath is null tho?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's why I included a reference to the migration file replacing null by an empty string.
However if it still possible to receive null I will modify my PR accordingly.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we simplify like this to cover both null and empty string just in case:

Suggested change
if (playerPath.length === 0) return vlcCommand(cb)
if (!playerPath) return vlcCommand(cb)

process.nextTick(() => cb(null))
}

function spawn (playerPath, url, title) {
if (playerPath != null) return spawnExternal(playerPath, [url])
if (playerPath.length !== 0) return spawnExternal(playerPath, [url])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Likewise here:

Suggested change
if (playerPath.length !== 0) return spawnExternal(playerPath, [url])
if (playerPath) return spawnExternal(playerPath, [url])


// Try to find and use VLC if external player is not specified
vlcCommand((err, vlcPath) => {
Expand Down