Skip to content
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

GHMilestone throws NPE on null state #2028

Open
rnveach opened this issue Feb 10, 2025 · 0 comments
Open

GHMilestone throws NPE on null state #2028

rnveach opened this issue Feb 10, 2025 · 0 comments

Comments

@rnveach
Copy link

rnveach commented Feb 10, 2025

The following method is not null safe:

public GHMilestoneState getState() {
return Enum.valueOf(GHMilestoneState.class, state.toUpperCase(Locale.ENGLISH));

Whenever it is called to get the state of the milestone, and it (state field) is null, it will throw a NullPointerException.

There is no other method in this class to ascertain the value of this before calling the method. The field is private. Programmers are forced to wrap this in a try/catch in the case it is null.

It would ease handling this call if it had a null check and returned null if there is no state.

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

No branches or pull requests

1 participant