org-element: Fix cache bug

* lisp/org-element.el (org-element-context): First initialize cache
  before retrieving data from it.
This commit is contained in:
Nicolas Goaziou 2014-02-26 14:55:45 +01:00
parent dddebc26c8
commit ef207f4424
1 changed files with 4 additions and 2 deletions

View File

@ -5782,8 +5782,10 @@ Providing it allows for quicker computation."
(let* ((restriction (org-element-restriction type))
(parent element)
(candidates 'initial)
(cache (and (org-element--cache-active-p)
(gethash element org-element--cache-objects)))
(cache (cond ((not (org-element--cache-active-p)) nil)
(org-element--cache-objects
(gethash element org-element--cache-objects))
(t (org-element-cache-reset) nil)))
objects-data next)
(prog1
(catch 'exit