diff --git a/src/core/manager.c b/src/core/manager.c index 33d7aa1cbb..0e21e14bec 100644 --- a/src/core/manager.c +++ b/src/core/manager.c @@ -3543,16 +3543,16 @@ ManagerState manager_state(Manager *m) { /* Is the special shutdown target active or queued? If so, we are in shutdown state */ u = manager_get_unit(m, SPECIAL_SHUTDOWN_TARGET); - if (unit_active_or_pending(u)) + if (u && unit_active_or_pending(u)) return MANAGER_STOPPING; /* Are the rescue or emergency targets active or queued? If so we are in maintenance state */ u = manager_get_unit(m, SPECIAL_RESCUE_TARGET); - if (unit_active_or_pending(u)) + if (u && unit_active_or_pending(u)) return MANAGER_MAINTENANCE; u = manager_get_unit(m, SPECIAL_EMERGENCY_TARGET); - if (unit_active_or_pending(u)) + if (u && unit_active_or_pending(u)) return MANAGER_MAINTENANCE; /* Are there any failed units? If so, we are in degraded mode */