MZ Help to finish a plugin script for a Skill Type Swap System

Oh, whoops. clearStates is also used to initialise the _states array, so I should've checked to make sure _states exists here:
JavaScript:
const s = this._states.filter(hasTag);  // get present tagged state IDs
E.g.
JavaScript:
const s = this._states ? this._states.filter(hasTag) : [];  // get present tagged state IDs
I've edited that correction into my previous post~ 👋
Excellent, I tested it and is working perfectly.

Thank you caethyril and all the others.

Case closed.
Great! Happy RPG Making~

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/help-to-finish-a-plugin-script-for-a-skill-type-swap-system.174052/