From: "Stefan-W. Hahn" <info@s-hahn.de>
To: emacs-orgmode@gnu.org
Subject: [PATCH] Org-bibtex: checking string length in org-bibtex-read before using aref
Date: Fri, 21 Feb 2014 17:27:59 +0100 [thread overview]
Message-ID: <20140221162758.GT7560@pille.home> (raw)
[-- Attachment #1: Type: text/plain, Size: 431 bytes --]
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.
[-- Attachment #2: 0001-PATCH-Org-bibtex-checking-string-length-in-org-bibte.patch --]
[-- Type: text/x-diff, Size: 1240 bytes --]
From e5fa86104d94e69575d6c4ff54d0aa41b7083440 Mon Sep 17 00:00:00 2001
From: "Stefan-W. Hahn" <stefan.hahn@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.hahn@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
next reply other threads:[~2014-02-21 16:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-21 16:27 Stefan-W. Hahn [this message]
2014-02-24 16:36 ` [PATCH] Org-bibtex: checking string length in org-bibtex-read before using aref Nicolas Goaziou
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20140221162758.GT7560@pille.home \
--to=info@s-hahn.de \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.