Fix dbus shutdown events not continuing if they are not valid

This commit is contained in:
wzshiming 2021-01-12 14:33:39 +08:00
parent 9caf675ed1
commit 0413529b62

View File

@ -142,11 +142,12 @@ func (bus *DBusCon) MonitorShutdown() (<-chan bool, error) {
case event := <-busChan: case event := <-busChan:
if event == nil || len(event.Body) == 0 { if event == nil || len(event.Body) == 0 {
klog.Errorf("Failed obtaining shutdown event, PrepareForShutdown event was empty") klog.Errorf("Failed obtaining shutdown event, PrepareForShutdown event was empty")
continue
} }
shutdownActive, ok := event.Body[0].(bool) shutdownActive, ok := event.Body[0].(bool)
if !ok { if !ok {
klog.Errorf("Failed obtaining shutdown event, PrepareForShutdown event was not bool type as expected") klog.Errorf("Failed obtaining shutdown event, PrepareForShutdown event was not bool type as expected")
return continue
} }
shutdownChan <- shutdownActive shutdownChan <- shutdownActive
} }