Browse Source

org-persist-read: Do not try to read non-existing containers

Ihor Radchenko 3 years ago
parent
commit
8821ff5811
1 changed files with 6 additions and 2 deletions
  1. 6 2
      lisp/org-persist.el

+ 6 - 2
lisp/org-persist.el

@@ -649,8 +649,12 @@ A buffer is treated as (:buffer ASSOCIATED).
 A string is treated as (:file ASSOCIATED)."
   (setq associated (org-persist--normalize-associated associated))
   (setq container (org-persist--normalize-container container))
-  (let* ((collection (org-persist--get-collection container associated))
-         (persist-file (org-file-name-concat org-persist-directory (plist-get collection :persist-file)))
+  (let* ((collection (org-persist--find-index `(:container ,container :associated ,associated)))
+         (persist-file
+          (when collection
+            (org-file-name-concat
+             org-persist-directory
+             (plist-get collection :persist-file))))
          (data nil))
     (when (and collection
                (file-exists-p persist-file)