fix packer crash that occurs when image is nil

This commit is contained in:
Megan Marsh 2018-12-17 14:54:27 -08:00
parent a734aa2255
commit 19144111dd
1 changed files with 6 additions and 1 deletions

View File

@ -89,9 +89,14 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
return nil, err
}
image, ok := state.GetOk("image")
if !ok {
return nil, err
}
// Build the artifact and return it
artifact := &Artifact{
Image: state.Get("image").(core.Image),
Image: image.(core.Image),
Region: region,
driver: driver,
}