📝 Algorithms and data structures implemented in JavaScript with explanations and links to further readings
Null Reference Exception (#817)
When `n.next = tail` is true, we assign `n` to `tail` and `null` to `tail.next`, so `n.next` also becomes `null`. Then we assign `n.next.next` (because now `n.next` is `null`), we try to get `next` of `null`. That is why we should add an `else` case to check if `n.next` is not equal to `tail`. Co-authored-by: Oleksii Trekhleb <trehleb@gmail.com>
S
Seymur committed
53781db2757d782c787ce9980b719a21008a995e
Parent: 4704820
Committed by GitHub <noreply@github.com>
on 1/22/2022, 9:19:14 AM