From 2b6528ca3ed1e193c5ee66809f6789c5c703039b Mon Sep 17 00:00:00 2001 From: Alex Liebowitz Date: Wed, 10 May 2017 21:27:57 -0400 Subject: [PATCH] Fix argv.length check in makeSingleInstance callback Also correct length of argv: with Electron, there's just the executable, not interpreter + filename. --- app/main.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/main.js b/app/main.js index aa0cde89f..e2e4c992a 100644 --- a/app/main.js +++ b/app/main.js @@ -178,19 +178,19 @@ function quitNow() { } const isSecondaryInstance = app.makeSingleInstance((argv) => { - if (process.argv.length < 3) { + if (argv.length < 2) { return; } if (!win) { - openUri = argv[2]; + openUri = argv[1]; } else { if (win.isMinimized()) { win.restore(); win.focus(); } - win.webContents.send('open-uri-requested', argv[2]); + win.webContents.send('open-uri-requested', argv[1]); } }); @@ -347,11 +347,11 @@ if (process.platform == 'darwin') { win.webContents.send('open-uri-requested', uri); } }); -} else if (process.argv.length >= 3) { +} else if (process.argv.length >= 2) { // No open-url event on Win, but we can still handle URIs provided at launch time if (!win) { - openUri = process.argv[2]; + openUri = process.argv[1]; } else { - win.webContents.send('open-uri-requested', process.argv[2]); + win.webContents.send('open-uri-requested', process.argv[1]); } }