From 4ef2c0e439af3e7218ee0c1fe8eda72a94597a1a Mon Sep 17 00:00:00 2001 From: Kyle Meyer Date: Mon, 24 Aug 2015 00:10:54 -0400 Subject: [PATCH] org-footnote-action: Handle nil context * lisp/org-footnote.el (org-footnote-action): Check whether context is non-nil before trying to move to the end of the element. --- lisp/org-footnote.el | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el index c3af9653e..10e95ee67 100644 --- a/lisp/org-footnote.el +++ b/lisp/org-footnote.el @@ -662,11 +662,12 @@ offer additional commands in a menu." (type (org-element-type context))) (cond ;; On white space after element, insert a new footnote. - ((> (point) - (save-excursion - (goto-char (org-element-property :end context)) - (skip-chars-backward " \t") - (point))) + ((and context + (> (point) + (save-excursion + (goto-char (org-element-property :end context)) + (skip-chars-backward " \t") + (point)))) (org-footnote-new)) ((eq type 'footnote-reference) (let ((label (org-element-property :label context)))