So I want to clarify, the conventions for both parties (Let's use fictional parties to mask any partisan elements: One party shall be named the Stupid Party and the other is the Evil Party... feel free to have them line up with either real party you see fit to deserve that alignment) but the elections are months away? This would put the date as somewhere between early July and the First Tuesday of the First Monday in November. The charged candidate (Evil Party) is still innocent of the crime until a jury convicts him. He can still run while he is charged... heck, he can even be elected with charges pending (At this point, there's some serious debate if you can have the trial of the President while he is in office). The Stupid Party Nominee would be... well, an idiot if they did not milk this turn of events for all it's worth, so it's very unlikely that the Evil Party Nominee could be, in order, A) Nominated, B) Charged with a serious crime C) Tried and Convicted of aforementioned serious crime and D) all before election day and a win for Evil Party Nominee. Specifically, the trial of a major party candidate would take months of pre-trial motions alone, to say nothing of the jury selection which is gonna have a fun time finding jurors impartial enough to fairly judge an individual who is running for President... good luck finding 12 recluses with no outside forms of communication and no political affiliations.
So in all likelihood, if Evil Party Candidate gets elected, they will likely be inaugurated and then immediately Congress will start serious impeachment discussions. At this point, upon some removal of the President from office by impeachment or arrest, the Vice President becomes President as the President clearly cannot discharge his duties.
Prior to the conventions, it depends on how presumptive the front runner is, but both parties have internal mechanisms to handle a situation where the nominee is not clearly determined by the votes.