If any statute shall provide a punishment of the same character, but of milder type, for an offense which was a crime under pre-existing law, then such milder punishment may be imposed by the court but no conviction, otherwise valid, shall be set aside and new trial granted merely because of an error of the court in fixing punishment. Such error shall only entitle the party injured to vacate or reverse the judgment as to the punishment, and the legal punishment shall then be imposed by another sentence based on the original conviction or plea of guilty.