Merge pull request #85 from InnerGI/patch-1

Fixing undefined device when looping over buttonContext.
This commit is contained in:
Material Foundry
2021-12-17 02:03:39 +01:00
committed by GitHub

View File

@@ -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<d.buttons.length; i++){
if (clock != false) break;
if (d.buttons[i] == undefined) continue;
@@ -583,4 +583,4 @@ export class StreamDeck{
this.setIcon(context,device,url,{background:background});
this.setTitle(txt,context);
}
}
}