project--read-project-list: Handle corrupted file contents
authorDmitry Gutov <dmitry@gutov.dev>
Fri, 26 Jan 2024 00:52:35 +0000 (02:52 +0200)
committerDmitry Gutov <dmitry@gutov.dev>
Fri, 26 Jan 2024 01:00:23 +0000 (03:00 +0200)
* lisp/progmodes/project.el (project--read-project-list):
Handle the 'end-of-file' error (bug#68546).

lisp/progmodes/project.el

index ab4504fa02745ccec7ca157ab0843953f51b15e0..da782ad55378eb8987f4a7c9f6d0188484a2ee8e 100644 (file)
@@ -1707,7 +1707,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)