Skip to content

Commit ccc823f

Browse files
committed
nil check in salvaging task so to fix nil dereference in it
1 parent d0ecdb4 commit ccc823f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/backend/redis/worker.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ func (b *Backend) SalvageWorker(ctx context.Context, queueUID, salvagingWorkerUI
360360
pipe.Del(b.workerPendingTaskQueueKey(queue.UID.String(), salvageTargetWorker.UID.String()))
361361
pipe.Set(b.workerKey(queue.UID.String(), salvageTargetWorker.UID.String()), marshaledSalvageTargetWorker, -1)
362362
for i, t := range tasksToSalvage {
363-
if len(t.Status.History) > 0 &&
363+
if len(t.Status.History) > 0 && t.Status.History[len(t.Status.History)-1].SalvagedBy != nil &&
364364
*t.Status.History[len(t.Status.History)-1].SalvagedBy == salvagingWorker.UID {
365365
workerUID := t.Status.History[len(t.Status.History)-1].WorkerUID
366366
pipe.SRem(b.workerTasksKey(queue.UID.String(), workerUID), t.UID)

0 commit comments

Comments
 (0)