fix crash that occurs when dir is nil

This commit is contained in:
Megan Marsh 2018-11-27 16:34:26 -08:00
parent 89fb8f0d3e
commit ec75913412
1 changed files with 4 additions and 1 deletions

View File

@ -49,7 +49,10 @@ func (a *artifact) State(name string) interface{} {
}
func (a *artifact) Destroy() error {
return a.dir.RemoveAll()
if a.dir != nil {
return a.dir.RemoveAll()
}
return nil
}
func NewArtifact(remoteType string, format string, exportOutputPath string, vmName string, skipExport bool, keepRegistered bool, state multistep.StateBag) (packer.Artifact, error) {