use snap.Alloc.TaskStates only after confirming snap.Alloc is not nil

This commit is contained in:
Bastiaan Bakker 2016-11-07 22:35:00 +01:00
parent 46893c7558
commit 2c864172eb

View file

@ -122,7 +122,6 @@ func (r *AllocRunner) RestoreState() error {
r.ctx = snap.Context
r.allocClientStatus = snap.AllocClientStatus
r.allocClientDescription = snap.AllocClientDescription
r.taskStates = snap.Alloc.TaskStates
var snapshotErrors multierror.Error
if r.alloc == nil {
@ -135,6 +134,8 @@ func (r *AllocRunner) RestoreState() error {
return e
}
r.taskStates = snap.Alloc.TaskStates
// Restore the task runners
var mErr multierror.Error
for name, state := range r.taskStates {