org-bibtex: Fix `org-bibtex-read' on an empty field

* lisp/org-bibtex.el (org-bibtex-read): Check string length before
  using aref.

If a field in a bibtex entry is empty:

@article(test,
   description = "")

the function org-bibtex-read throws an exception because of
using aref on this empty string.

The solution is to check the length of the string before.

TINYCHANGE

Signed-off-by: Stefan-W. Hahn <stefan.hahn@s-hahn.de>
This commit is contained in:
Stefan-W. Hahn 2014-02-21 17:19:39 +01:00 committed by Nicolas Goaziou
parent 4298a21b82
commit 2e72176e21
1 changed files with 2 additions and 1 deletions

View File

@ -613,7 +613,8 @@ This uses `bibtex-parse-entry'."
(strip-delim
(lambda (str) ; strip enclosing "..." and {...}
(dolist (pair '((34 . 34) (123 . 125) (123 . 125)))
(when (and (= (aref str 0) (car pair))
(when (and (> (length str) 1)
(= (aref str 0) (car pair))
(= (aref str (1- (length str))) (cdr pair)))
(setf str (substring str 1 (1- (length str)))))) str)))
(push (mapcar