Skip to content

Commit

Permalink
internal/task: fix nil panic in (*internal/task.Stack).Pop
Browse files Browse the repository at this point in the history
While adding some code to clear the Next field when popping from a task stack for safety reasons, the clear was placed outside of a nil pointer check.
As a result, (*internal/task.Stack).Pop panicked when the Stack is empty.
  • Loading branch information
niaow authored and aykevl committed May 8, 2020
1 parent ccd79ee commit ae2cbbf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/internal/task/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ func (s *Stack) Pop() *Task {
t := s.top
if t != nil {
s.top = t.Next
t.Next = nil
}
t.Next = nil
return t
}

Expand Down

0 comments on commit ae2cbbf

Please sign in to comment.