-
-
Notifications
You must be signed in to change notification settings - Fork 397
Update PersonFollowingList.cs #6360
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
Update PersonFollowingList.cs #6360
Conversation
Improve GetSpouse: add null-check
|
@YesuCS Thanks for getting involved like this. Can you share the details on how one can reproduce the issue you're encountering (for this fix)? It didn't quite jump out to me at a quick glance. |
|
@YesuCS Since you might have been out of office last week, I just wanted to check with you again regarding my above question. |
|
Hi Nick! If the first person in the group isn't married, it seemed like we could skip the rest of the loop since a spouse wouldn’t be expected in that case. I added a null check to avoid that, but totally understand if this isn’t a needed change I just started looking for small ways to contribute and open to any feedback. |
|
Ah, I see what you're saying... I guess the other code changes threw me off a bit. If you want to just fix that one comment‡ we'll merge your PR into the develop branch. Thanks in advance! ‡ Somewhere in our Developer Codex we mention writing comments as full sentences (found the link!) but also use only two slashes |
Fixed comment
YesuCS
left a comment
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.
Thank you, I adjusted the comment to be more clear and formatted correctly.
| person.MaritalStatusValue != null && | ||
| person.MaritalStatusValue.Guid.Equals( marriedGuid ) && | ||
| m.GroupRole.Guid.Equals( adultGuid ) ) | ||
| // Early null check to return null if not married or no spouse found |
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.
@YesuCS There's still an indentation issue here (either a tab or spacing problem), but I'm going to merge it and then adjust as needed. Try looking into that for next time.
|
@YesuCS I forgot to ask... Who are you? We usually know pretty much everyone in the Rock community but I couldn't tell from your GH profile name. Let me know and I'll increment the PR count stat we keep track of for our community members. |
|
my username on rocket chat is yesu.chum! I'm with houstons first baptist church. |
Improve GetSpouse: add null-check
Notice
In case you are submitting a non bug-fix-PR, we highly recommend you to engage in a PR discussion first.
There are many factors we consider before accepting a pull request. This includes:
With the PR discussion we can assess your proposed changes before you start working on it so that we can come up with the best possible approach to it. This may include:
Proposed Changes
Add an early null-check on person.MaritalStatusValue so we return null instead of throwing when it’s missing or not “Married”
Preserve the existing LINQ flow for finding the other married adult in the family
Types of changes
What types of changes does your code introduce to Rock?
Put an
xin the boxes that applyChecklist
Put an
xin the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.Further comments
This change simply hardens the existing GetSpouse(Person) helper against null data. No behavior changes beyond preventing potential null-reference crashes.
Documentation
No documentation updates needed—this does not affect any public UI or docs.
Migrations
None