HAs don’t exist in Gen 4. I’m not super familiar with the Pokémon data substructure in Gen 4, but I know that in Gen 3, it’s actually impossible for a Pokémon to have an illegal ability because of the way the game stores the Pokémon’s ability. Could be the same in Gen 4.