Moving your king into check is against the rules of chess. If a player makes such a move, it should be retracted and a legal move made instead.