Commit 53781db
Null Reference Exception (trekhleb#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 <[email protected]>1 parent 4704820 commit 53781db
1 file changed
+2
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
107 | 109 | | |
108 | | - | |
109 | 110 | | |
110 | 111 | | |
111 | 112 | | |
| |||
0 commit comments