set ack time only if command is not nil

This commit is contained in:
Victor Vrantchan
2019-06-30 00:27:45 -04:00
parent 127955dc74
commit ed0e372a6e

View File

@@ -83,11 +83,11 @@ func (db *Store) nextCommand(ctx context.Context, resp mdm.Response) (*Command,
case "Acknowledged":
// move to completed, send next
x, a := cut(dc.Commands, resp.CommandUUID)
x.Acknowledged = time.Now().UTC()
dc.Commands = a
if x == nil {
break
}
x.Acknowledged = time.Now().UTC()
dc.Completed = append(dc.Completed, *x)
case "Error":
// move to failed, send next