diff --git a/lib/graphics.js b/lib/graphics.js index 3ad0340..83c4cd3 100644 --- a/lib/graphics.js +++ b/lib/graphics.js @@ -144,7 +144,7 @@ function graphics(callback) { try { graphicsArr.forEach(function (item) { // controllers - const bus = ((item.sppci_bus || '').indexOf('builtin') >= 0 ? 'Built-In' : ((item.sppci_bus || '').indexOf('pcie') >= 0 ? 'PCIe' : '')); + const bus = ((item.sppci_bus || '').indexOf('builtin') > -1 ? 'Built-In' : ((item.sppci_bus || '').indexOf('pcie') > -1 ? 'PCIe' : '')); const vram = (parseInt((item.spdisplays_vram || ''), 10) || 0) * (((item.spdisplays_vram || '').indexOf('GB') > -1) ? 1024 : 1); const vramDyn = (parseInt((item.spdisplays_vram_shared || ''), 10) || 0) * (((item.spdisplays_vram_shared || '').indexOf('GB') > -1) ? 1024 : 1); let metalVersion = getMetalVersion(item.spdisplays_metal || item.spdisplays_metalfamily || ''); @@ -164,7 +164,7 @@ function graphics(callback) { // displays if (item.spdisplays_ndrvs && item.spdisplays_ndrvs.length) { item.spdisplays_ndrvs.forEach(function (displayItem) { - const connectionType = displayItem['spdisplays_connection_type']; + const connectionType = displayItem['spdisplays_connection_type'] || ''; const currentResolutionParts = (displayItem['_spdisplays_resolution'] || '').split('@'); const currentResolution = currentResolutionParts[0].split('x'); const pixelParts = (displayItem['_spdisplays_pixels'] || '').split('x'); @@ -178,8 +178,8 @@ function graphics(callback) { serial: serial !== '0' ? serial : null, displayId: displayItem['_spdisplays_displayID'] || null, main: displayItem['spdisplays_main'] ? displayItem['spdisplays_main'] === 'spdisplays_yes' : false, - builtin: (displayItem['spdisplays_display_type'] || '').indexOf('built-in') >= 0, - connection: ((connectionType.indexOf('_internal')) ? 'Internal' : ((connectionType.indexOf('_displayport')) ? 'Display Port' : ((connectionType.indexOf('_hdmi')) ? 'HDMI' : ''))), + builtin: (displayItem['spdisplays_display_type'] || '').indexOf('built-in') > -1, + connection: ((connectionType.indexOf('_internal') > -1) ? 'Internal' : ((connectionType.indexOf('_displayport') > -1) ? 'Display Port' : ((connectionType.indexOf('_hdmi') > -1) ? 'HDMI' : ''))), sizeX: null, sizeY: null, pixelDepth: (pixelDepthString === 'CGSThirtyBitColor' ? 30 : (pixelDepthString === 'CGSThirtytwoBitColor' ? 32 : (pixelDepthString === 'CGSTwentyfourBitColor' ? 24 : ''))),