Skip to content

Null Reference Exception #817

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 22, 2022
Merged

Null Reference Exception #817

merged 2 commits into from
Jan 22, 2022

Conversation

Seymur
Copy link
Contributor

@Seymur Seymur commented Dec 23, 2021

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.

Seymur and others added 2 commits December 23, 2021 20:34
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`.
@trekhleb trekhleb changed the base branch from master to merge January 22, 2022 09:19
@trekhleb trekhleb merged commit 53781db into trekhleb:merge Jan 22, 2022
@Seymur Seymur deleted the patch-1 branch January 22, 2022 09:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants