From ccc823ffff6e2b3948fc0aa645e5032b3879aa35 Mon Sep 17 00:00:00 2001 From: Shingo Omura Date: Fri, 13 Nov 2020 12:28:19 +0900 Subject: [PATCH] nil check in salvaging task so to fix nil dereference in it --- pkg/backend/redis/worker.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/backend/redis/worker.go b/pkg/backend/redis/worker.go index 5e69433..79afea5 100644 --- a/pkg/backend/redis/worker.go +++ b/pkg/backend/redis/worker.go @@ -360,7 +360,7 @@ func (b *Backend) SalvageWorker(ctx context.Context, queueUID, salvagingWorkerUI pipe.Del(b.workerPendingTaskQueueKey(queue.UID.String(), salvageTargetWorker.UID.String())) pipe.Set(b.workerKey(queue.UID.String(), salvageTargetWorker.UID.String()), marshaledSalvageTargetWorker, -1) for i, t := range tasksToSalvage { - if len(t.Status.History) > 0 && + if len(t.Status.History) > 0 && t.Status.History[len(t.Status.History)-1].SalvagedBy != nil && *t.Status.History[len(t.Status.History)-1].SalvagedBy == salvagingWorker.UID { workerUID := t.Status.History[len(t.Status.History)-1].WorkerUID pipe.SRem(b.workerTasksKey(queue.UID.String(), workerUID), t.UID)