Skip to content

Commit

Permalink
Merge pull request #5807 from SJuliez/firingarc-null-guard
Browse files Browse the repository at this point in the history
More guards for the FiringarcHandler
  • Loading branch information
SJuliez authored Jul 28, 2024
2 parents fde43fd + c87f3f7 commit 658662e
Showing 1 changed file with 10 additions and 1 deletion.
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

0 comments on commit 658662e

Please sign in to comment.