Add isNull check for List size in toString method