The followingif statement should only execute if the replacement was successful.
The unpatched checkif condition is not robust to additions of new states of AddProofStatus.
This patch makes the checkcondition more explicit which is easier to read and more robust to
future changes.