A person shall not be convicted of an assault with intent to commit a crime, or of any other attempt to commit an offense, when it shall appear that the crime intended or the offense attempted was perpetrated by such person at the time of such assault or in pursuance of such attempt.