[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals-release/org a8c9f11757 2/2: Fix missing null check for
From: |
ELPA Syncer |
Subject: |
[elpa] externals-release/org a8c9f11757 2/2: Fix missing null check for tangle links during export |
Date: |
Wed, 21 Dec 2022 07:57:56 -0500 (EST) |
branch: externals-release/org
commit a8c9f117572059316cefb90659a5c0a859ecb3d9
Author: Tom Gillespie <tgbugs@gmail.com>
Commit: Ihor Radchenko <yantar92@posteo.net>
Fix missing null check for tangle links during export
* lisp/ob-tangle.el (org-babel-tangle--unbracketed-link): Add the let
bound variable l to the and statement to prevent l from being passed
to `string-match' in the event that it is nil.
When tangling nested noweb blocks during export it is possible for the
results of `org-store-link' to return nil. This commit ensures that
the value returned for l is only passed to `string-match' when it is
non-nil, avoiding a `wrong-type-argument' (stringp nil) error.
Handling of comments and nesting of babel blocks is known to have
issues. The bug is from 8a781d35dc68f20fa2a5546c98ba3d9b77ee3cda
where new code was introduced to obtain the value for bare which was
not present in early code. I'm guessing that the bug appears now
because `string-match' is called on l (aka link) at a point in time
when it was never previously called and it was thus masked because in
the old version it was impossible to call `string-match' when `link'
was nil because another variable was always nil, masking the issue.
---
lisp/ob-tangle.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index bd17bda32b..fd6b6f3b94 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -500,7 +500,8 @@ The PARAMS are the 3rd element of the info for the same src
block."
(cl-letf (((symbol-function 'org-store-link-functions)
(lambda () nil)))
(org-store-link nil))))
- (bare (and (string-match org-link-bracket-re l)
+ (bare (and l
+ (string-match org-link-bracket-re l)
(match-string 1 l))))
(when bare
(if (and org-babel-tangle-use-relative-file-links