Skip to content

Commit 646e068

Browse files
committed
api/checkpoint: Don't return null if no checkpoints
This fixes a bug where no checkpoints would produce a `null` response instead of an empty array: ``` $ docker run -d --name foo nginx:alpine 17fbeff7185733f101c38cb8208359dd0ef141116a1345da2d3c3f58c11f3e14 $ curl --unix-socket /var/run/docker.sock http://local/containers/foo/checkpoints null ``` With this patch, this becomes: ``` $ curl --unix-socket /var/run/docker.sock http://local/containers/foo/checkpoints [] ``` Signed-off-by: Paweł Gronowski <[email protected]>
1 parent 2670796 commit 646e068

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

daemon/server/router/checkpoint/checkpoint_routes.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ func (cr *checkpointRouter) getContainerCheckpoints(ctx context.Context, w http.
3939
if err != nil {
4040
return err
4141
}
42+
if checkpoints == nil {
43+
checkpoints = []checkpoint.Summary{}
44+
}
4245

4346
return httputils.WriteJSON(w, http.StatusOK, checkpoints)
4447
}

0 commit comments

Comments
 (0)