Skip to content

Conversation

hero5512
Copy link
Contributor

It has already been checked inside the Apply function, so there’s no need to check it again.

@s1na
Copy link
Contributor

s1na commented Oct 1, 2025

If it's nil the call to Apply will panic?

@s1na s1na closed this Oct 1, 2025
@hero5512
Copy link
Contributor Author

hero5512 commented Oct 1, 2025

If it's nil the call to Apply will panic?

No, Apply() checks if o == nil at line 138 before accessing any fields, so calling it on a nil receiver is safe

@s1na
Copy link
Contributor

s1na commented Oct 1, 2025

Yes you're right but still I don't think this is necessary to change. The check in Apply is a defensive check. It's still good practice to check also outside before calling a method on it.

@hero5512
Copy link
Contributor Author

hero5512 commented Oct 1, 2025

Yes you're right but still I don't think this is necessary to change. The check in Apply is a defensive check. It's still good practice to check also outside before calling a method on it.

Got that

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