-
-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Conversation
https://github.com/webtorrent/webtorrent-desktop/blob/eb5a291c8b9cbfae96f306e153387e720a7baa72/src/renderer/lib/migrations.js#L219 cause external player to be a empty string instead of a null one
src/main/external-player.js
Outdated
@@ -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) |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
src/main/external-player.js
Outdated
@@ -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) |
There was a problem hiding this comment.
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:
if (playerPath.length === 0) return vlcCommand(cb) | |
if (!playerPath) return vlcCommand(cb) |
src/main/external-player.js
Outdated
process.nextTick(() => cb(null)) | ||
} | ||
|
||
function spawn (playerPath, url, title) { | ||
if (playerPath != null) return spawnExternal(playerPath, [url]) | ||
if (playerPath.length !== 0) return spawnExternal(playerPath, [url]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Likewise here:
if (playerPath.length !== 0) return spawnExternal(playerPath, [url]) | |
if (playerPath) return spawnExternal(playerPath, [url]) |
I considered that null should be also accepted without throwing based on @mathiasvr review and change the PR content accordingly. |
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. |
webtorrent-desktop/src/renderer/lib/migrations.js
Line 219 in eb5a291
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?