mirror of
https://github.com/Koenkk/zigbee2mqtt.git
synced 2026-08-14 06:40:05 +00:00
fix: Fix crash on a null color in attribute output (#32784)
This commit is contained in:
+4
-1
@@ -465,7 +465,10 @@ export class Controller {
|
||||
let message: string | undefined;
|
||||
|
||||
// Special cases
|
||||
if (key === "color" && utils.objectHasProperties(subPayload, ["r", "g", "b"])) {
|
||||
// `objectHasProperties` indexes its argument, so it has to be given an object.
|
||||
// The null check three lines below is too late: `color` is nullable like any
|
||||
// other attribute, and a null one reaches here before that branch runs.
|
||||
if (key === "color" && subPayload != null && utils.objectHasProperties(subPayload, ["r", "g", "b"])) {
|
||||
subPayload = [subPayload.r, subPayload.g, subPayload.b];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user