[Bug] Fix old session load modifier crash (#5814)

Fix inability to load saves due to modifier type being nulled
This commit is contained in:
Sirz Benjie 2025-05-12 15:33:52 -05:00 committed by GitHub
parent d790b30a30
commit 9b1a222935
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -2921,7 +2921,10 @@ export default class BattleScene extends SceneBase {
instant?: boolean, instant?: boolean,
cost?: number, cost?: number,
): boolean { ): boolean {
if (!modifier) { // We check against modifier.type to stop a bug related to loading in a pokemon that has a form change item, which prior to some patch
// that changed form change modifiers worked, had previously set the `type` field to null.
// TODO: This is not the right place to check for this; it should ideally go in a session migrator.
if (!modifier || !modifier.type) {
return false; return false;
} }
let success = false; let success = false;