]> git.eshelyaron.com Git - emacs.git/commitdiff
project--read-project-list: Handle corrupted file contents
authorDmitry Gutov <dmitry@gutov.dev>
Fri, 26 Jan 2024 00:52:35 +0000 (02:52 +0200)
committerEshel Yaron <me@eshelyaron.com>
Fri, 26 Jan 2024 11:22:45 +0000 (12:22 +0100)
* lisp/progmodes/project.el (project--read-project-list):
Handle the 'end-of-file' error (bug#68546).

(cherry picked from commit 22a58fccb763da6ec52f4bea98f91647b71ee1f0)

lisp/progmodes/project.el

index 325e207b70d4924e90359920bfca005a7c637a59..9996a3aa556ef9f49b97f76911223add048b57ed 100644 (file)
@@ -1702,7 +1702,10 @@ With some possible metadata (to be decided).")
                  (let ((name (car elem)))
                    (list (if (file-remote-p name) name
                            (abbreviate-file-name name)))))
-               (read (current-buffer))))))
+               (condition-case nil
+                   (read (current-buffer))
+                 (end-of-file
+                  (warn "Failed to read the projects list file due to unexpected EOF")))))))
     (unless (seq-every-p
              (lambda (elt) (stringp (car-safe elt)))
              project--list)