Skip to content

Commit

Permalink
nil check in salvaging task so to fix nil dereference in it
Browse files Browse the repository at this point in the history
  • Loading branch information
everpeace committed Nov 13, 2020
1 parent d0ecdb4 commit ccc823f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/backend/redis/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit ccc823f

Please sign in to comment.