org-table: Fix freeze with invalid hline reference

* lisp/org-table.el (org-table-find-row-type): Don't end up on the
  last hline, which doesn't exist, per
  e793158bc8.

Reported-by: Artis Rozentāls <artis.rozentals@gmail.com>
<http://permalink.gmane.org/gmane.emacs.orgmode/93654>
This commit is contained in:
Nicolas Goaziou 2014-12-30 22:37:44 +01:00
parent 1853fb546d
commit 44744bba2c
1 changed files with 7 additions and 4 deletions

View File

@ -3017,10 +3017,13 @@ and TABLE is a vector with line types."
nil))
t)))
(setq n (1- n)))
(if (or (< i 0) (>= i l))
(user-error "Row descriptor %s used in line %d leads outside table"
desc cline)
i)))
(cond ((or (< i 0) (>= i l))
(user-error "Row descriptor %s used in line %d leads outside table"
desc cline))
;; The last hline doesn't exist. Instead, point to last row
;; in table.
((= i (1- l)) (1- i))
(t i))))
(defun org-table--error-on-old-row-references (s)
(when (string-match "&[-+0-9I]" s)