From 86db07a12f6d41e9cc398b22ac7b914ff51f8cf7 Mon Sep 17 00:00:00 2001 From: Oleksandr Yakushev Date: Wed, 9 Oct 2024 14:59:52 +0300 Subject: [PATCH] [docstring] Don't crash if string doc is nil --- CHANGELOG.md | 1 + cider-docstring.el | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39ec0d575..f5ab81717 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ ### Bugs fixed - [#3742](https://github.com/clojure-emacs/cider/issues/3742): Restore syntax highlighting in result minibuffer. +- [#3747](https://github.com/clojure-emacs/cider/issues/3747): Fix errors when docstring is nil. ## 1.16.0 (2024-09-24) diff --git a/cider-docstring.el b/cider-docstring.el index 65742169e..2ff46e1e4 100644 --- a/cider-docstring.el +++ b/cider-docstring.el @@ -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.