Skip to content

Commit b46650d

Browse files
iwankgbCreatone
authored andcommittedJul 9, 2024··
Avoiding nil pointer in podmanFactory.CanHandleAndAccept()
1 parent f163691 commit b46650d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed
 

‎container/podman/factory.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,12 @@ func (f *podmanFactory) CanHandleAndAccept(name string) (handle bool, accept boo
9191
id := dockerutil.ContainerNameToId(name)
9292

9393
ctnr, err := InspectContainer(id)
94-
if err != nil || !ctnr.State.Running {
94+
if err != nil {
9595
return false, true, fmt.Errorf("error inspecting container: %v", err)
9696
}
97-
97+
if ctnr.State == nil || !ctnr.State.Running {
98+
return false, true, fmt.Errorf("container not running")
99+
}
98100
return true, true, nil
99101
}
100102

0 commit comments

Comments
 (0)
Please sign in to comment.