[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', () => {
|
resp.on('end', () => {
|
||||||
logger.debug('resp.on.end', {data, url});
|
logger.debug('resp.on.end', {data, url});
|
||||||
if (data.length) {
|
if (data.length) {
|
||||||
const respBody = JSON.parse(data);
|
try {
|
||||||
if (respBody.status === 'OK') {
|
const respBody = JSON.parse(data);
|
||||||
resolve(true);
|
if (respBody.status === 'OK') {
|
||||||
return;
|
resolve(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
logger.error('Cannot parse response')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
resolve(false);
|
resolve(false);
|
||||||
|
|
Loading…
Reference in a new issue