Fixed NPE in ManaPaid events usage

This commit is contained in:
Oleg Agafonov 2023-04-01 18:58:00 +04:00
parent ad3b76dae6
commit 1bc4b9d675
2 changed files with 3 additions and 3 deletions

View file

@ -22,7 +22,7 @@ public class ManaPoolItem implements Serializable, Emptiable {
private int black = 0;
private int colorless = 0;
private ConditionalMana conditionalMana;
private MageObject sourceObject;
private MageObject sourceObject; // source of the mana, can be null (what's use case for null values? JayDi85)
private UUID originalId; // originalId of the mana producing ability
private boolean flag = false;
private Duration duration;

View file

@ -59,10 +59,10 @@ public class ManaPaidSourceWatcher extends Watcher {
private void increment(MageObject sourceObject, ManaType manaType, Game game) {
total++;
if (sourceObject.hasSubtype(SubType.TREASURE, game)) {
if (sourceObject != null && sourceObject.hasSubtype(SubType.TREASURE, game)) {
treasure++;
}
if (!sourceObject.isSnow()) {
if (sourceObject != null && !sourceObject.isSnow()) {
return;
}
switch (manaType) {