aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBozhidar Batsov <bozhidar@batsov.dev>2026-02-28 10:42:52 +0200
committerBozhidar Batsov <bozhidar@batsov.dev>2026-02-28 10:51:37 +0200
commitd91744559890dccafba76136f75218a10ab2a148 (patch)
treea1c6a83eb1452528e2c8aff8d52647a271241e66
parentefd0a0abe1956d4a3d0f7ce0eefc2059766e8009 (diff)
Don't store nil in project cache on corrupt/empty cache files
When projectile-unserialize returns nil (corrupt or empty file), don't store nil in projectile-projects-cache. A nil entry prevents future reload attempts until the user manually invalidates.
-rw-r--r--projectile.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/projectile.el b/projectile.el
index 1a4429e..57b6ce4 100644
--- a/projectile.el
+++ b/projectile.el
@@ -1154,7 +1154,9 @@ The cache is created both in memory and on the hard drive."
"Load the cache file for PROJECT-ROOT in memory."
(when-let* ((cache-file (projectile-project-cache-file project-root)))
(when (file-exists-p cache-file)
- (puthash project-root (projectile-unserialize cache-file) projectile-projects-cache))))
+ (when-let* ((data (projectile-unserialize cache-file)))
+ (puthash project-root data projectile-projects-cache)
+ data))))
;;;###autoload
(defun projectile-purge-file-from-cache (file)