Skip to content

Commit

Permalink
[docstring] Don't crash if string doc is nil
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-yakushev committed Oct 9, 2024
1 parent be4b4ac commit 5eaec61
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions cider-docstring.el
Original file line number Diff line number Diff line change
Expand Up @@ -143,9 +143,10 @@ Prioritize rendering as much as possible while staying within `cider-docstring-m

(cl-defun cider-docstring--trim (string &optional (max-lines cider-docstring-max-lines))
"Return MAX-LINES of STRING, adding \"...\" if trimming was necessary."
(let* ((lines (split-string string "\n"))
(string (string-join (seq-take lines max-lines) "\n")))
(concat string (when (> (length lines) max-lines) "..."))))
(when string
(let* ((lines (split-string string "\n"))
(string (string-join (seq-take lines max-lines) "\n")))
(concat string (when (> (length lines) max-lines) "...")))))

(defun cider-docstring--format (string)
"Return a nicely formatted STRING to be displayed to the user.
Expand Down

0 comments on commit 5eaec61

Please sign in to comment.