Skip to content

Commit

Permalink
Avoiding nil pointer in podmanFactory.CanHandleAndAccept()
Browse files Browse the repository at this point in the history
  • Loading branch information
iwankgb authored and Creatone committed Jul 9, 2024
1 parent f163691 commit b46650d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions container/podman/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,12 @@ func (f *podmanFactory) CanHandleAndAccept(name string) (handle bool, accept boo
id := dockerutil.ContainerNameToId(name)

ctnr, err := InspectContainer(id)
if err != nil || !ctnr.State.Running {
if err != nil {
return false, true, fmt.Errorf("error inspecting container: %v", err)
}

if ctnr.State == nil || !ctnr.State.Running {
return false, true, fmt.Errorf("container not running")
}
return true, true, nil
}

Expand Down

0 comments on commit b46650d

Please sign in to comment.