-
Notifications
You must be signed in to change notification settings - Fork 115
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
NPE prevention for new moves #545
base: develop
Are you sure you want to change the base?
Conversation
…gram load when encountering unrecognized moves.
…gram load when encountering unrecognized moves.
Seems really cool! Will review thoroughly soon. |
} else { | ||
weaveEnergyUsageRatio = (double) Math.abs(pm2.getEnergy()) / (double) pm1.getEnergy(); | ||
} | ||
if (pm1 != null && pm2 != null) { |
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.
Wouldn't a' if ( conditions ) return 0.0;' more simple and legible? Consider this comment on the others validations as well.
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.
It's a style preference. My employer has strict rules on only one return from a method for code maintenance, so it has snuck its way into my coding.
I haven't reviewed the changes in great detail but I've applied the changes and I've been running a couple of days now without any issues so far, fwiw. |
Heya. Can you resolve the current conflicts after the PR adding Gen 2 got merged? |
Added null checks and default return values so current iteration of program will still start and load known pokemon even if moves are unknown.