-
Notifications
You must be signed in to change notification settings - Fork 10k
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
Adding null-conditional operator on IEnumerable.GetEnumerator() #16947
Conversation
Looks like there can also be a null ref in |
Okay, I've attempted to integrate the recommended updates. Let me know how it looks. |
Are you interested in fixing |
In the code snippet, it seemed like line 98 was doing a null check? Also, I'm kind of new to the github resolution system ... since that comment didn't have the conversational display (and resolution button) like the other comments I thought it might have been a momentary concern that was self-resolved. Let me know if you still want it updated? |
Yeah, but the after the null check line 104 uses |
Great Catch! Since it seems like .CopyTo wants to copy the items into the dictionary, what if around line 102 EnsureDictionary() was called to initialize |
It's copying from I think just adding an |
Can do! |
So, I started going down the route of using an I also added a unit test for it. I'm not sure if I hit the standards on it. Sorry for the back and forth, I should have just implemented it on the first review pass. |
This comment was made automatically. If there is a problem contact aspnetcore-build@microsoft.com. I've triaged the above build. I've created/commented on the following issue(s) |
Thanks @smaglio81 ! |
Summary of the changes (Less than 80 chars)
?.
operator to prevent null reference exception (_items?.GetEnumerator()
)Addresses #16938