Browse Source

Check if marker is valid before use

* lisp/org-agenda.el (org-agenda-do-context-action): Check if marker
is valid before use.
Leo 13 years ago
parent
commit
5e67e9d824
1 changed files with 7 additions and 7 deletions
  1. 7 7
      lisp/org-agenda.el

+ 7 - 7
lisp/org-agenda.el

@@ -6784,13 +6784,13 @@ When called with a prefix argument, include all archive files as well."
 (defun org-agenda-do-context-action ()
   "Show outline path and, maybe, follow mode window."
   (let ((m (org-get-at-bol 'org-marker)))
-    (if (and org-agenda-follow-mode m)
-	(if org-agenda-follow-indirect
-	    (org-agenda-tree-to-indirect-buffer)
-	  (org-agenda-show)))
-    (if (and m org-agenda-show-outline-path)
-	(org-with-point-at m
-	  (org-display-outline-path t)))))
+    (when (and (markerp m) (marker-buffer m))
+      (and org-agenda-follow-mode
+	   (if org-agenda-follow-indirect
+	       (org-agenda-tree-to-indirect-buffer)
+	     (org-agenda-show)))
+      (and org-agenda-show-outline-path
+	   (org-with-point-at m (org-display-outline-path t))))))
 
 (defun org-agenda-show-priority ()
   "Show the priority of the current item.