Skip to content

Commit 92a240f

Browse files
authored
Merge pull request moby#51797 from lujinda/fix_shutdown_panic
fix: prevent potential panic in Shutdown when EventsService is nil
2 parents 5b18361 + 5c637b7 commit 92a240f

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

daemon/daemon.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1498,7 +1498,9 @@ func (daemon *Daemon) Shutdown(ctx context.Context) error {
14981498
// running anymore. If there are still some open connections to the
14991499
// '/events' endpoint, closing the EventsService should tear them down
15001500
// immediately.
1501-
daemon.EventsService.Close()
1501+
if daemon.EventsService != nil {
1502+
daemon.EventsService.Close()
1503+
}
15021504

15031505
return daemon.cleanupMounts(cfg)
15041506
}

0 commit comments

Comments
 (0)