-
Notifications
You must be signed in to change notification settings - Fork 654
Fix NullReferenceException #827
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
Conversation
@@ -113,7 +113,7 @@ public static Commit FindCommitBranchWasBranchedFrom([NotNull] this Branch branc | |||
mergeBaseCommit = findMergeBase, | |||
branch = otherBranch | |||
}; | |||
}).Where(b => b != null).OrderByDescending(b => b.mergeBaseCommit.Committer.When).ToList(); | |||
}).Where(b => b.mergeBaseCommit != null).OrderByDescending(b => b.mergeBaseCommit.Committer.When).ToList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can b
be null
as the original code suggests? Then it would need to be
Where(b => b != null && b.mergeBaseCommit != null)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍, updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scratch my comment. I read the entire file and it cannot be null since the select returns a new anonymous object
Thanks! LGTM. As @danielmarbach mentioned the null check on b is not required. If you can revert back to your first version I can merge this. |
@pascalberger what about like 76? |
@SzymonPobiega Good catch 👍 Missed this one. |
Could we get a 3.4.2 patch?
|
Needs to be done by @JakeGinnivan. What do you think? Maybe just a patch release with this commit and without any of the other changes if they are not properly tested yet. |
Patch would be awesome
|
Fixes
I guess that the
b => b != null
check was OK but then the result type of theSelect
was changed fromCommit
to an anonymous type and the check stopped to prevent null commits to come to downstream operators.