Unnecessary check in replace logic

pointless check in if statement, we've already ascertained that either there is no object, or that the length is 0, three lines above.