Skip to content

chore: add safety checks to NoteCommand #1086

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
May 6, 2024

Conversation

SimonVerhoeven
Copy link
Contributor

Resolves #1085

@SimonVerhoeven SimonVerhoeven requested a review from a team as a code owner April 13, 2024 11:37
@Taz03
Copy link
Member

Taz03 commented Apr 13, 2024

It is intentionally kept like that, because the values can never be null

@Taz03 Taz03 closed this Apr 13, 2024
@Zabuzard Zabuzard reopened this Apr 13, 2024
Copy link
Member

@Zabuzard Zabuzard left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this change is small, a bit unnecessary but totally okay.

both approaches are totally fine and valid. intentionally triggering a NPE by using a possibly-null-but-required-not-null object versus explicitly using Objects.requireNonNull are both valid and almost identical.

we had a lengthy discussion on this matter in the past and decided to accept both ways.

generally, id suggest to not run through the entire code base and substitute one by one. but i have nothing against this PR, nor if ud use that style while writing a feature.

just don't make PRs only for that (opinionated) change, i guess.

fine for now though 👍

@tj-wazei
Copy link

tj-wazei commented May 6, 2024

Approving + merging as I have tested the behavior. An exception is fine even though unlikely to occur. The exception won't leak out any important information or crash the bot so this is good to go.

@tj-wazei tj-wazei enabled auto-merge (squash) May 6, 2024 15:54
@tj-wazei tj-wazei merged commit 2c3da71 into Together-Java:develop May 6, 2024
9 checks passed
@ankitsmt211 ankitsmt211 mentioned this pull request May 15, 2024
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.

Note command lacks safety checks in onSlashCommand like BanCommand
5 participants