Added check for null before adding cur-character class to character in listing