From b296a7311b9d27c56014cc7b35802ead4e2a0e1f Mon Sep 17 00:00:00 2001 From: Jannik Schönartz Date: Thu, 24 Jun 2021 12:32:18 +0000 Subject: [server/external-backends/idoit] Small undefined read fix --- server/lib/external-backends/backends/idoit-backend.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'server') diff --git a/server/lib/external-backends/backends/idoit-backend.js b/server/lib/external-backends/backends/idoit-backend.js index 1c328ec..4abc81e 100644 --- a/server/lib/external-backends/backends/idoit-backend.js +++ b/server/lib/external-backends/backends/idoit-backend.js @@ -524,7 +524,7 @@ class IdoitBackend extends ExternalBackends { } // Update the object. CPU data. - if (client.cpus) { + if (client.cpus && client.cpus.length > 0) { const boundedCpus = boundObjects.filter(response => response.id.startsWith('READ_C__CATG__CPU'))[0].result .map(cpu => { return { @@ -571,7 +571,7 @@ class IdoitBackend extends ExternalBackends { } // GPUS - if (client.gpus) { + if (client.gpus && client.gpus.length > 0) { const boundedGpus = boundObjects.filter(response => response.id.startsWith('READ_C__CATG__GRAPHIC'))[0].result .map(gpu => { return { @@ -611,7 +611,7 @@ class IdoitBackend extends ExternalBackends { } // Update the object. Ram data. - if (client.ram) { + if (client.ram && client.ram.modules && client.ram.modules.length > 0) { const boundedRams = boundObjects.filter(response => response.id.startsWith('READ_C__CATG__MEMORY'))[0].result .map(bRam => { return { @@ -663,7 +663,7 @@ class IdoitBackend extends ExternalBackends { } // Update the object. Drive data. - if (client.drives) { + if (client.drives && client.drives.length > 0) { const boundedDrives = boundObjects.filter(response => response.id.startsWith('READ_C__CATG__STORAGE_DEVICE'))[0].result .map(bDrive => { return { @@ -722,7 +722,7 @@ class IdoitBackend extends ExternalBackends { } // Add Monitors - if (client.monitors) { + if (client.monitors && client.monitors.length > 0) { // Monitor is a custom object, therefore the fieldnames can be looked up in the idoit interface / api const boundedMonitors = boundObjects.filter(response => response.id.startsWith('READ_C__CATG__CUSTOM_FIELDS_MONITOR'))[0].result .map(bMonitor => { -- cgit v1.2.3-55-g7522