Skip to content

Commit a4f7c86

Browse files
committed
Fix queue potential bugs
1 parent 04d84d9 commit a4f7c86

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

queue.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -420,11 +420,11 @@ func (q *LinkedListQueue[T]) Shift() (T, error) {
420420
if q.first == nil {
421421
q.last = nil
422422
}
423-
val := node.Val
423+
val := *node.Val
424424

425425
q.recycleNode(node)
426426

427-
return *val, nil
427+
return val, nil
428428
}
429429

430430
// Unshift Unshift the T val to the first position(non-blocking)

0 commit comments

Comments
 (0)