branch: externals/denote
commit 01251c6c5da86f32661cd7133aeec6845f91527c
Author: Kierin Bell <ferns...@fernseed.me>
Commit: Kierin Bell <ferns...@fernseed.me>

    Check for empty sequence in 'denote-sequence-get-all-files-with-prefix'
    
    This prevents an error when calling 'denote-sequence-split' with an
    empty string.  In particular, this happens when
    'denote-sequence-get-relative' is called with TYPE 'siblings' on a
    top-level sequence.  'denote-sequence-get-all-sequences-with-prefix' is
    apparently not used in a context where it would receive an empty
    sequence, but check for empty sequences there as well for consistency.
---
 denote-sequence.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/denote-sequence.el b/denote-sequence.el
index 30145a79b2..ac60cb4be9 100644
--- a/denote-sequence.el
+++ b/denote-sequence.el
@@ -363,7 +363,8 @@ A sequence is a Denote signature that conforms with 
`denote-sequence-p'.
 
 With optional FILES, operate on them, else use the return value of
 `denote-directory-files'."
-  (let ((prefix (denote-sequence-split sequence)))
+  (when-let* (((not (string-empty-p sequence)))
+              (prefix (denote-sequence-split sequence)))
     (seq-filter
      (lambda (file)
        (when-let* ((file-sequence (denote-sequence-file-p file)))
@@ -396,7 +397,8 @@ With optional SEQUENCES operate on those, else use the 
return value of
 `denote-sequence-get-all-sequences'.
 
 A sequence is a Denote signature that conforms with `denote-sequence-p'."
-  (let ((prefix (denote-sequence-split sequence)))
+  (when-let* (((not (string-empty-p sequence)))
+              (prefix (denote-sequence-split sequence)))
     (seq-filter
      (lambda (string)
        (denote-sequence--sequence-prefix-p prefix string))

Reply via email to