server: add nil checks to not panic
Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
parent
5ed79fb5cd
commit
404194c1fd
3 changed files with 14 additions and 2 deletions
|
@ -29,6 +29,10 @@ func (s *Server) PortForward(ctx context.Context, req *pb.PortForwardRequest) (*
|
|||
func (ss streamService) PortForward(podSandboxID string, port int32, stream io.ReadWriteCloser) error {
|
||||
c := ss.runtimeServer.GetSandboxContainer(podSandboxID)
|
||||
|
||||
if c == nil {
|
||||
return fmt.Errorf("could not find container for sandbox %q", podSandboxID)
|
||||
}
|
||||
|
||||
if err := ss.runtimeServer.runtime.UpdateStatus(c); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue