Skip to content

Commit

Permalink
Merge pull request #1351 from jessvalarezo/check-nil-spec
Browse files Browse the repository at this point in the history
metadata: container spec nil check
  • Loading branch information
stevvooe committed Aug 14, 2017
2 parents cf1b593 + e5cf147 commit 6a4a09d
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions metadata/containers.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,14 +262,19 @@ func writeContainer(bkt *bolt.Bucket, container *containers.Container) error {
return err
}

spec, err := container.Spec.Marshal()
if err != nil {
return err
if container.Spec != nil {
spec, err := container.Spec.Marshal()
if err != nil {
return err
}

if err := bkt.Put(bucketKeySpec, spec); err != nil {
return err
}
}

for _, v := range [][2][]byte{
{bucketKeyImage, []byte(container.Image)},
{bucketKeySpec, spec},
{bucketKeyRootFS, []byte(container.RootFS)},
} {
if err := bkt.Put(v[0], v[1]); err != nil {
Expand Down

0 comments on commit 6a4a09d

Please sign in to comment.