Merge pull request #114 from lbryio/version-info-logic-fix
Don't try to send version info to render process if window isn't open
This commit is contained in:
commit
f5dec02fd9
1 changed files with 9 additions and 3 deletions
12
app/main.js
12
app/main.js
|
@ -52,19 +52,25 @@ function checkForNewVersion(callback) {
|
|||
const [_, remoteVersion] = tagName.match(/^v([\d.]+(?:-?rc\d+)?)$/);
|
||||
if (!remoteVersion) {
|
||||
console.log('Malformed remote version string:', tagName);
|
||||
win.webContents.send('version-info-received', null);
|
||||
if (win) {
|
||||
win.webContents.send('version-info-received', null);
|
||||
}
|
||||
} else {
|
||||
console.log('Remote version:', remoteVersion);
|
||||
const upgradeAvailable = semver.gt(formatRc(remoteVersion), formatRc(localVersion));
|
||||
console.log(upgradeAvailable ? 'Upgrade available' : 'No upgrade available');
|
||||
win.webContents.send('version-info-received', {remoteVersion, localVersion, upgradeAvailable});
|
||||
if (win) {
|
||||
win.webContents.send('version-info-received', {remoteVersion, localVersion, upgradeAvailable});
|
||||
}
|
||||
}
|
||||
})
|
||||
});
|
||||
|
||||
req.on('error', (err) => {
|
||||
console.log('Failed to get current version from GitHub. Error:', err);
|
||||
win.webContents.send('version-info-received', null);
|
||||
if (win) {
|
||||
win.webContents.send('version-info-received', null);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue