Skip to content

Commit 25cd300

Browse files
authored
Merge pull request #150 from klihub/fixes/dont-return-nil-response-with-nil-error
stub: don't return nil response without an error.
2 parents 82c65a7 + 09b3e3c commit 25cd300

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

pkg/stub/stub.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ func (stub *stub) Shutdown(ctx context.Context, _ *api.ShutdownRequest) (*api.Sh
720720
func (stub *stub) CreateContainer(ctx context.Context, req *api.CreateContainerRequest) (*api.CreateContainerResponse, error) {
721721
handler := stub.handlers.CreateContainer
722722
if handler == nil {
723-
return nil, nil
723+
return &api.CreateContainerResponse{}, nil
724724
}
725725
adjust, update, err := handler(ctx, req.Pod, req.Container)
726726
return &api.CreateContainerResponse{
@@ -733,7 +733,7 @@ func (stub *stub) CreateContainer(ctx context.Context, req *api.CreateContainerR
733733
func (stub *stub) UpdateContainer(ctx context.Context, req *api.UpdateContainerRequest) (*api.UpdateContainerResponse, error) {
734734
handler := stub.handlers.UpdateContainer
735735
if handler == nil {
736-
return nil, nil
736+
return &api.UpdateContainerResponse{}, nil
737737
}
738738
update, err := handler(ctx, req.Pod, req.Container, req.LinuxResources)
739739
return &api.UpdateContainerResponse{
@@ -745,7 +745,7 @@ func (stub *stub) UpdateContainer(ctx context.Context, req *api.UpdateContainerR
745745
func (stub *stub) StopContainer(ctx context.Context, req *api.StopContainerRequest) (*api.StopContainerResponse, error) {
746746
handler := stub.handlers.StopContainer
747747
if handler == nil {
748-
return nil, nil
748+
return &api.StopContainerResponse{}, nil
749749
}
750750
update, err := handler(ctx, req.Pod, req.Container)
751751
return &api.StopContainerResponse{
@@ -757,7 +757,7 @@ func (stub *stub) StopContainer(ctx context.Context, req *api.StopContainerReque
757757
func (stub *stub) UpdatePodSandbox(ctx context.Context, req *api.UpdatePodSandboxRequest) (*api.UpdatePodSandboxResponse, error) {
758758
handler := stub.handlers.UpdatePodSandbox
759759
if handler == nil {
760-
return nil, nil
760+
return &api.UpdatePodSandboxResponse{}, nil
761761
}
762762
err := handler(ctx, req.Pod, req.OverheadLinuxResources, req.LinuxResources)
763763
return &api.UpdatePodSandboxResponse{}, err

0 commit comments

Comments
 (0)