Fixed segfault when listing and last line is empty