diff options
author | Matthew Heon <matthew.heon@pm.me> | 2020-06-02 17:10:57 -0400 |
---|---|---|
committer | Matthew Heon <matthew.heon@pm.me> | 2020-06-02 17:22:00 -0400 |
commit | 4b37d4d5af50b67742e5f3097075e7493488d91a (patch) | |
tree | cd3de69116973b3e2206c72853c802339b0e4423 /pkg/domain/infra/abi/containers.go | |
parent | c4ccd7cbc1509bab6183c47f740cbf2cc4ee0424 (diff) | |
download | podman-4b37d4d5af50b67742e5f3097075e7493488d91a.tar.gz podman-4b37d4d5af50b67742e5f3097075e7493488d91a.tar.bz2 podman-4b37d4d5af50b67742e5f3097075e7493488d91a.zip |
Fix a segfault in `podman inspect -l` w/ no containers
We also need to rework container/image inspect to be separate,
but that can happen in another PR.
Fixes #6472
Signed-off-by: Matthew Heon <matthew.heon@pm.me>
Diffstat (limited to 'pkg/domain/infra/abi/containers.go')
-rw-r--r-- | pkg/domain/infra/abi/containers.go | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/pkg/domain/infra/abi/containers.go b/pkg/domain/infra/abi/containers.go index e982c7c11..7f606ed7c 100644 --- a/pkg/domain/infra/abi/containers.go +++ b/pkg/domain/infra/abi/containers.go @@ -44,8 +44,10 @@ func getContainersAndInputByContext(all, latest bool, names []string, runtime *l ctrs, err = runtime.GetAllContainers() case latest: ctr, err = runtime.GetLatestContainer() - rawInput = append(rawInput, ctr.ID()) - ctrs = append(ctrs, ctr) + if err == nil { + rawInput = append(rawInput, ctr.ID()) + ctrs = append(ctrs, ctr) + } default: for _, n := range names { ctr, e := runtime.LookupContainer(n) |