Skip to content

Commit 0b9ff50

Browse files
committed
Fix issues with SoftButtonObject equals method
1 parent 5ba7373 commit 0b9ff50

1 file changed

Lines changed: 23 additions & 5 deletions

File tree

lib/js/src/manager/screen/utils/SoftButtonObject.js

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -369,18 +369,36 @@ class SoftButtonObject {
369369
if (states[index].getSoftButton().getText() !== otherStates[index].getSoftButton().getText()) {
370370
return false;
371371
}
372-
if (states[index].getSoftButton().getImage() !== otherStates[index].getSoftButton().getImage()) {
372+
if ((states[index].getSoftButton().getImage() === null && otherStates[index].getSoftButton().getImage() !== null) ||
373+
(states[index].getSoftButton().getImage() !== null && otherStates[index].getSoftButton().getImage() === null)) {
373374
return false;
374375
}
376+
if (states[index].getSoftButton().getImage() !== null && otherStates[index].getSoftButton().getImage() !== null) {
377+
if (states[index].getSoftButton().getImage().getValueParam() !== otherStates[index].getSoftButton().getImage().getValueParam()) {
378+
return false;
379+
}
380+
if (states[index].getSoftButton().getImage().getImageType() !== otherStates[index].getSoftButton().getImage().getImageType()) {
381+
return false;
382+
}
383+
if (states[index].getSoftButton().getImage().getIsTemplate() !== otherStates[index].getSoftButton().getImage().getIsTemplate()) {
384+
return false;
385+
}
386+
}
375387
if (states[index].getSoftButton().getSoftButtonID() !== otherStates[index].getSoftButton().getSoftButtonID()) {
376388
return false;
377389
}
378-
// The SdlFile equals() method checks most but not all of the SdlArtwork fields
379-
if (states[index].getArtwork().equals(otherStates[index].getArtwork())) {
390+
if ((states[index].getArtwork() === null && otherStates[index].getArtwork() !== null) ||
391+
(states[index].getArtwork() !== null && otherStates[index].getArtwork() === null)) {
380392
return false;
381393
}
382-
if (states[index].getArtwork().isTemplateImage() !== otherStates[index].getArtwork().isTemplateImage()) {
383-
return false;
394+
if (states[index].getArtwork() !== null && otherStates[index].getArtwork() !== null) {
395+
// The SdlFile equals() method checks most but not all of the SdlArtwork fields
396+
if (!states[index].getArtwork().equals(otherStates[index].getArtwork())) {
397+
return false;
398+
}
399+
if (states[index].getArtwork().isTemplateImage() !== otherStates[index].getArtwork().isTemplateImage()) {
400+
return false;
401+
}
384402
}
385403
}
386404
}

0 commit comments

Comments
 (0)