Simplify the if test by removing extra duplicate test.