mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-12 23:13:40 +00:00
internal/task: fix nil panic in (*internal/task.Stack).Pop
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.
This commit is contained in:
@@ -68,8 +68,8 @@ func (s *Stack) Pop() *Task {
|
|||||||
t := s.top
|
t := s.top
|
||||||
if t != nil {
|
if t != nil {
|
||||||
s.top = t.Next
|
s.top = t.Next
|
||||||
|
t.Next = nil
|
||||||
}
|
}
|
||||||
t.Next = nil
|
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user