fix a potential panic when map is nil

Signed-off-by: Allen Sun <shlallen1990@gmail.com>
This commit is contained in:
Allen Sun 2017-09-27 13:58:48 +08:00 committed by Allen Sun
parent cc9f58ac24
commit 382dafefc0

View File

@ -80,10 +80,10 @@ func (i *image) Unpack(ctx context.Context, snapshotterName string) error {
if err != nil {
return err
}
if info.Labels == nil {
info.Labels = map[string]string{}
}
if info.Labels["containerd.io/uncompressed"] != layer.Diff.Digest.String() {
if info.Labels == nil {
info.Labels = map[string]string{}
}
info.Labels["containerd.io/uncompressed"] = layer.Diff.Digest.String()
if _, err := cs.Update(ctx, info, "labels.containerd.io/uncompressed"); err != nil {
return err