Luck, I think. Or maybe certain HEXes are more managable than others. I think it's kinda like yellow MissingNo. Sometimes it freezes, other times it doesn't.
Of course I'm no expert, but that's my guess. Just keeping trying.
EDIT: Oh wait, when is the game freezing? If it's freezing at the encounter screen, I stick to the advice above. If it's freezing when you try to attack, that always happens. In order to escape, use any battle item and the battle will suddenly end, and you're free to explore the other effects of this glitch.