[Hotfix] Prevent crash with two NG Pokemon fainting at the same time (#6751)

Prevent crash with two NG Pokemon fainting at the same time
This commit is contained in:
Dean 2025-11-04 12:07:19 -08:00 committed by GitHub
parent 5a8ff3a47f
commit aea463ab4b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1532,6 +1532,11 @@ export class SuppressAbilitiesTag extends SerializableArenaTag {
const setter = globalScene
.getField(true)
.filter(p => p.hasAbilityWithAttr("PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr", false))[0];
// Setter may not exist if both NG Pokemon faint simultaneously
if (setter == null) {
return;
}
applyOnGainAbAttrs({
pokemon: setter,
passive: setter.getAbility().hasAttr("PreLeaveFieldRemoveSuppressAbilitiesSourceAbAttr"),