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

More guards for the FiringarcHandler #5807

Merged
merged 2 commits into from
Jul 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,18 @@ public FiringArcSpriteHandler(BoardView boardView, ClientGUI clientGUI) {
* @param weapon the selected weapon
* @param movePath planned movement in the movement phase
*/
public void update(Entity entity, WeaponMounted weapon, @Nullable MovePath movePath) {
public void update(@Nullable Entity entity, @Nullable WeaponMounted weapon, @Nullable MovePath movePath) {
firingEntity = entity;
if ((entity == null) || (weapon == null)) {
clearValues();
return;
}
int weaponId = entity.getEquipmentNum(weapon);
if (weaponId == -1) {
// entities are replaced all the time by server-sent changes, must always guard
clearValues();
return;
}
// findRanges must be called before any call to testUnderWater due to usage of
// global-style variables for some reason
findRanges(weapon);
Expand Down