I did manage to work out a counter measure so it wouldn't cause the battle to crash. Was kind of funny just having battles end randomly when i was testing though :P