Fixed duplicate if error reported by cppcheck. Refs #8881.
Merge remote-tracking branch 'origin/feature/8881_fix_dup_if'