git-p4: Ensure the working directory and the index are clean before "git-p4 rebase"
[gitweb.git] / builtin-rev-list.c
index 1cb5f67119a37b8490c76f4846372ba28a316fbf..de80158fd4762aa692193edb7c0f8e85e6189877 100644 (file)
@@ -520,7 +520,7 @@ static void read_revisions_from_stdin(struct rev_info *revs)
 
        while (fgets(line, sizeof(line), stdin) != NULL) {
                int len = strlen(line);
-               if (line[len - 1] == '\n')
+               if (len && line[len - 1] == '\n')
                        line[--len] = 0;
                if (!len)
                        break;