Add better error message for spread move crash

This commit is contained in:
Guangcong Luo
2019-08-25 05:37:14 -04:00
parent f1a560f90a
commit 260dcb0f2f

View File

@@ -1395,7 +1395,12 @@ class Battle {
targets.push(target.side.missedPokemon);
} else {
for (const hitTarget of kwArgs.spread.split(',')) {
targets.push(this.getPokemon(hitTarget + ': ?')!);
const target = this.getPokemon(hitTarget + ': ?');
if (!target) {
this.log(['error', `Invalid spread move target: "${hitTarget}"`]);
continue;
}
targets.push(target);
}
}