From 117a1fb59d963478b2e8d9e0450995a2e7934b95 Mon Sep 17 00:00:00 2001 From: Logan Marin Date: Sat, 23 Oct 2021 21:48:13 -0500 Subject: [PATCH] Fixing undefined device when looping over buttonContext. --- src/streamDeck.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/streamDeck.js b/src/streamDeck.js index 1bc6f48..8482eba 100644 --- a/src/streamDeck.js +++ b/src/streamDeck.js @@ -61,7 +61,7 @@ export class StreamDeck{ clearContext(device,action,coordinates = {column:0,row:0}){ for (let d of this.buttonContext) { - if (d.device == device) { + if (d?.device == device) { const num = coordinates.column + coordinates.row*d.size.columns; d.buttons[num] = undefined; return; @@ -241,7 +241,7 @@ export class StreamDeck{ //if (src != 'modules/MaterialDeck/img/black.png') for (let d of this.buttonContext) { - if (d.device == device) { + if (d?.device == device) { for (let i=0; i