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

Fix #1807 (VLC does not start) #1850

merged 2 commits into from
Jul 31, 2020

Conversation

Hinara
Copy link
Contributor

@Hinara Hinara commented Jul 25, 2020

function migrate_0_22_0 (saved) {
cause external player to be a empty string instead of a null one

What is the purpose of this pull request? (put an "X" next to item)

[ ] Documentation update
[X] Bug fix
[ ] New feature
[ ] Other, please explain:

What changes did you make? (Give an overview)
VLC does not start

Which issue (if any) does this pull request address?
Fix #1807

Is there anything you'd like reviewers to focus on?

@@ -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.

@@ -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
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])

@Hinara
Copy link
Contributor Author

Hinara commented Jul 30, 2020

I considered that null should be also accepted without throwing based on @mathiasvr review and change the PR content accordingly.

@hicom150
Copy link
Contributor

@Hinara as you correctly referenced, in the past we have made some changes #1704 #1702 so that all paths in the application should be default to '', so you shouldn't find any null in a path 😅

@hicom150 hicom150 merged commit 57d02aa into webtorrent:master Jul 31, 2020
@Hinara Hinara deleted the patch-1 branch August 1, 2020 09:24
@hicom150 hicom150 added this to the 0.24.0 milestone Aug 17, 2020
@feross
Copy link
Member

feross commented Aug 29, 2020

Thanks for the quick fix, folks! I'm going to put out a new WebTorrent Desktop release to get this into the hands of users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

VLC playing not working
6 participants