diff --git a/megamek/src/megamek/common/actions/WeaponAttackAction.java b/megamek/src/megamek/common/actions/WeaponAttackAction.java index 19a137259b1..1414fc441e0 100644 --- a/megamek/src/megamek/common/actions/WeaponAttackAction.java +++ b/megamek/src/megamek/common/actions/WeaponAttackAction.java @@ -555,11 +555,12 @@ private static ToHitData toHitCalc(Game game, int attackerId, Targetable target, || (atype.getAmmoType() == AmmoType.T_NLRM) || (atype.getAmmoType() == AmmoType.T_MEK_MORTAR)) && (munition.contains(AmmoType.Munitions.M_SEMIGUIDED))) { - for (TagInfo ti : game.getTagInfo()) { - if (target.getId() == ti.target.getId()) { - spotter = game.getEntity(ti.attackerId); - } - } + final Targetable currentTarget = target; // Required for concurrency reasons + spotter = game.getTagInfo().stream() + .filter(ti -> currentTarget.getId() == ti.target.getId()) + .findAny() + .map(ti -> game.getEntity(ti.attackerId)) + .orElse(null); } }