Quellcode durchsuchen

Fix group 0 bug for CCT (#353)

Chris Mullins vor 7 Jahren
Ursprung
Commit
b25bff16cb
1 geänderte Dateien mit 2 neuen und 2 gelöschten Zeilen
  1. 2 2
      lib/MiLight/CctPacketFormatter.cpp

+ 2 - 2
lib/MiLight/CctPacketFormatter.cpp

@@ -49,7 +49,7 @@ void CctPacketFormatter::finalizePacket(uint8_t* packet) {
 
 void CctPacketFormatter::updateBrightness(uint8_t value) {
   const GroupState* state = this->stateStore->get(deviceId, groupId, MiLightRemoteType::REMOTE_TYPE_CCT);
-  int8_t knownValue = state->isSetBrightness() ? state->getBrightness() : -1;
+  int8_t knownValue = (state != NULL && state->isSetBrightness()) ? state->getBrightness() : -1;
 
   valueByStepFunction(
     &PacketFormatter::increaseBrightness,
@@ -62,7 +62,7 @@ void CctPacketFormatter::updateBrightness(uint8_t value) {
 
 void CctPacketFormatter::updateTemperature(uint8_t value) {
   const GroupState* state = this->stateStore->get(deviceId, groupId, MiLightRemoteType::REMOTE_TYPE_CCT);
-  int8_t knownValue = state->isSetKelvin() ? state->getKelvin() : -1;
+  int8_t knownValue = (state != NULL && state->isSetKelvin()) ? state->getKelvin() : -1;
 
   valueByStepFunction(
     &PacketFormatter::increaseTemperature,