Skip to content

chore: add safety checks to NoteCommand - #1086

Merged
tj-wazei merged 2 commits into
Together-Java:developfrom
SimonVerhoeven:chore/noteSafety
May 6, 2024
Merged

chore: add safety checks to NoteCommand#1086
tj-wazei merged 2 commits into
Together-Java:developfrom
SimonVerhoeven:chore/noteSafety

Conversation

@SimonVerhoeven

Copy link
Copy Markdown
Contributor

Resolves #1085

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

Taz03 commented Apr 13, 2024

Copy link
Copy Markdown
Contributor

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

@Zabuzard Zabuzard left a comment

Copy link
Copy Markdown
Member

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

tj-wazei commented May 6, 2024

Copy link
Copy Markdown
Contributor

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
@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