branch: elpa/helm
commit e9c12605d2c7aa7a75b5db0ab545263cfd5192a9
Author: Ta Quang Trung <taquangtrun...@gmail.com>
Commit: Ta Quang Trung <taquangtrun...@gmail.com>

    fix: exception occuring when trimming empty summary string
---
 helm-lib.el | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/helm-lib.el b/helm-lib.el
index 8096a49e6d..d95022e43b 100644
--- a/helm-lib.el
+++ b/helm-lib.el
@@ -2024,9 +2024,11 @@ Directories expansion is not supported."
       (goto-char (point-min))
       (when (re-search-forward "^;;;?\\(.*\\) ---? \\(.*\\)" (pos-eol) t)
         (setq desc (match-string-no-properties 2)))
-      (if (or (null desc) (string= "" desc))
-          "Not documented"
-        (car (split-string desc "-\\*-" nil "[ \t\n\r-]+"))))))
+      (if-let ((_ (and desc (length> desc 0)))
+               (summary (car (split-string desc "-\\*-" nil)))
+               (_ (length> summary 0)))
+          (string-trim summary "[ \t\n\r-]+" "[ \t\n\r-]+")
+        "Not documented"))))
 
 (defun helm-local-directory-files (directory &rest args)
   "Run `directory-files' without tramp file name handlers.

Reply via email to