As long as there are no electrical circuits connected to pin 0/1 (with some exceptions) and you press the reset button just prior to uploading a new sketch (within a couple of seconds). The code of the prior sketch should not effect the uploading of a new sketch.
Given that, I have noticed that occasionally I can not upload a new sketch after some tests. This has always gone away for me with a power reset on the arduino (disconnect from the computer) although occasionally it has required a restart of the computer as well.