fixed a rare hue driver crash on startup and crash if an event sets an invalid scene id.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user