Replaced null character check with iterator end check.