[MM-56882] Fix a potential crash in diagnostics (#2960)
This commit is contained in:
parent
ad3da23863
commit
405403ca99
|
@ -72,10 +72,14 @@ export async function isOnline(logger: ElectronLog = log, url = IS_ONLINE_ENDPOI
|
|||
resp.on('end', () => {
|
||||
logger.debug('resp.on.end', {data, url});
|
||||
if (data.length) {
|
||||
const respBody = JSON.parse(data);
|
||||
if (respBody.status === 'OK') {
|
||||
resolve(true);
|
||||
return;
|
||||
try {
|
||||
const respBody = JSON.parse(data);
|
||||
if (respBody.status === 'OK') {
|
||||
resolve(true);
|
||||
return;
|
||||
}
|
||||
} catch (e) {
|
||||
logger.error('Cannot parse response')
|
||||
}
|
||||
}
|
||||
resolve(false);
|
||||
|
|
Loading…
Reference in a new issue