Fix missing error check in ContainerTop on Windows by jack0x2 · Pull Request #52025 · moby/moby (original) (raw)
- What I did
Fixed a missing error check in ContainerTop on Windows that could cause a nil pointer panic.
- How I did it
Added an if err != nil check after the IIFE that acquires the running task under lock in daemon/top_windows.go. Previously, if GetRunningTask() failed (e.g., container not running) or the container was in a restarting state, the error was silently dropped and task.Summary() was called on a nil task, resulting in a panic.
- How to verify it
- Run
docker topagainst a stopped or restarting Windows container. - Before this fix: nil pointer panic.
- After this fix: a proper error message is returned.
This matches the existing error handling pattern in daemon/top_unix.go.
- Human readable description for the release notes
Fix a panic when running docker top on a non-running Windows container.