Improved fix for Cppcheck warning. Remove useless conditions instead of adding a new one.