Fixed cppcheck error and compile warning. Refs #8655.