Good afternoon,

I have a problem with org-bibtex function org-bibtex-read if I have an
empty field in a bibitem like this:

@article(test,
   description = "")

In this case the "aref" gives an exception. I would like to suggest
the attached following fix.

With kind regards,
Stefan

-- 
Stefan-W. Hahn                          It is easy to make things.
                                        It is hard to make things simple.
From e5fa86104d94e69575d6c4ff54d0aa41b7083440 Mon Sep 17 00:00:00 2001
From: "Stefan-W. Hahn" <stefan.h...@s-hahn.de>
Date: Fri, 21 Feb 2014 17:19:39 +0100
Subject: [PATCH] [PATCH] Org-bibtex: checking string length in org-bibtex-read
 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.

TINY CHANGE.

Signed-off-by: Stefan-W. Hahn <stefan.h...@s-hahn.de>
---
 lisp/org-bibtex.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/org-bibtex.el b/lisp/org-bibtex.el
index b4e6977..7571169 100644
--- a/lisp/org-bibtex.el
+++ b/lisp/org-bibtex.el
@@ -613,7 +613,8 @@ (defun org-bibtex-read ()
 	(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) 0)
+			(= (aref str 0) (car pair))
 			(= (aref str (1- (length str))) (cdr pair)))
 	       (setf str (substring str 1 (1- (length str)))))) str)))
     (push (mapcar
-- 
1.9.0

Reply via email to