Merge pull request #85 from InnerGI/patch-1
Fixing undefined device when looping over buttonContext.
This commit is contained in:
@@ -61,7 +61,7 @@ export class StreamDeck{
|
|||||||
|
|
||||||
clearContext(device,action,coordinates = {column:0,row:0}){
|
clearContext(device,action,coordinates = {column:0,row:0}){
|
||||||
for (let d of this.buttonContext) {
|
for (let d of this.buttonContext) {
|
||||||
if (d.device == device) {
|
if (d?.device == device) {
|
||||||
const num = coordinates.column + coordinates.row*d.size.columns;
|
const num = coordinates.column + coordinates.row*d.size.columns;
|
||||||
d.buttons[num] = undefined;
|
d.buttons[num] = undefined;
|
||||||
return;
|
return;
|
||||||
@@ -241,7 +241,7 @@ export class StreamDeck{
|
|||||||
|
|
||||||
//if (src != 'modules/MaterialDeck/img/black.png')
|
//if (src != 'modules/MaterialDeck/img/black.png')
|
||||||
for (let d of this.buttonContext) {
|
for (let d of this.buttonContext) {
|
||||||
if (d.device == device) {
|
if (d?.device == device) {
|
||||||
for (let i=0; i<d.buttons.length; i++){
|
for (let i=0; i<d.buttons.length; i++){
|
||||||
if (clock != false) break;
|
if (clock != false) break;
|
||||||
if (d.buttons[i] == undefined) continue;
|
if (d.buttons[i] == undefined) continue;
|
||||||
@@ -583,4 +583,4 @@ export class StreamDeck{
|
|||||||
this.setIcon(context,device,url,{background:background});
|
this.setIcon(context,device,url,{background:background});
|
||||||
this.setTitle(txt,context);
|
this.setTitle(txt,context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user