Replace a redundant check with an assertion