fixed a rare hue driver crash on startup and crash if an event sets an invalid scene id.
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
2021-10-06 20:10:57 +02:00
parent def494ba45
commit cdf5173503
2 changed files with 8 additions and 0 deletions
+5
View File
@@ -177,6 +177,11 @@ func (p *Publisher) reassignDevice(device models.Device) bool {
// Stop here, no scene should be assigned.
return false
} else {
if p.sceneData[selectedAssignment.SceneID] == nil {
// Freeze until scene becomes available.
return false
}
}
if p.sceneAssignment[device.ID] != nil {
+3
View File
@@ -122,6 +122,9 @@ func (state *hueSensorState) Update(newData SensorData) *models.Event {
if time.Since(stateTime) > time.Second*3 {
return nil
}
if state.prevData == nil {
return nil
}
pe := state.prevData.State.ButtonEvent
ce := newData.State.ButtonEvent