diff options
author | OpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com> | 2019-07-08 18:00:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-07-08 18:00:11 +0200 |
commit | ed3acaecbfeead3b0fef5928e47ecc9f34cd8d5b (patch) | |
tree | 2ef0f0a0c9f3c2cd8798dee04de8c3d5ab292c36 /libpod/boltdb_state_internal.go | |
parent | 1055b22e9b900e5f4d41f39b506de4f2d1aa2f8e (diff) | |
parent | 1d36501f961889f554daf3c696fe95443ef211b6 (diff) | |
download | podman-ed3acaecbfeead3b0fef5928e47ecc9f34cd8d5b.tar.gz podman-ed3acaecbfeead3b0fef5928e47ecc9f34cd8d5b.tar.bz2 podman-ed3acaecbfeead3b0fef5928e47ecc9f34cd8d5b.zip |
Merge pull request #3496 from baude/golandcodeinspect
code cleanup
Diffstat (limited to 'libpod/boltdb_state_internal.go')
-rw-r--r-- | libpod/boltdb_state_internal.go | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/libpod/boltdb_state_internal.go b/libpod/boltdb_state_internal.go index 122bb5935..ee2784cdd 100644 --- a/libpod/boltdb_state_internal.go +++ b/libpod/boltdb_state_internal.go @@ -339,7 +339,6 @@ func getRuntimeConfigBucket(tx *bolt.Tx) (*bolt.Bucket, error) { } func (s *BoltState) getContainerFromDB(id []byte, ctr *Container, ctrsBkt *bolt.Bucket) error { - valid := true ctrBkt := ctrsBkt.Bucket(id) if ctrBkt == nil { return errors.Wrapf(define.ErrNoSuchCtr, "container %s not found in DB", string(id)) @@ -386,7 +385,7 @@ func (s *BoltState) getContainerFromDB(id []byte, ctr *Container, ctrsBkt *bolt. } ctr.runtime = s.runtime - ctr.valid = valid + ctr.valid = true return nil } @@ -639,7 +638,7 @@ func (s *BoltState) addContainer(ctr *Container, pod *Pod) error { } // Add ctr to pod - if pod != nil { + if pod != nil && podCtrs != nil { if err := podCtrs.Put(ctrID, ctrName); err != nil { return errors.Wrapf(err, "error adding container %s to pod %s", ctr.ID(), pod.ID()) } @@ -737,7 +736,7 @@ func (s *BoltState) removeContainer(ctr *Container, pod *Pod, tx *bolt.Tx) error } } - if podDB != nil { + if podDB != nil && pod != nil { // Check if the container is in the pod, remove it if it is podCtrs := podDB.Bucket(containersBkt) if podCtrs == nil { |