branch: externals/substitute
commit af3472dc3486a8fdda397c6e2fb46b39cee57192
Author: Protesilaos Stavrou <i...@protesilaos.com>
Commit: Protesilaos Stavrou <i...@protesilaos.com>

    Do not operate on nil thing
---
 substitute.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/substitute.el b/substitute.el
index 82a3daa2f9..15bc38a0a5 100644
--- a/substitute.el
+++ b/substitute.el
@@ -182,8 +182,10 @@ Report a `user-error' if no target is found."
   (cond
    ((region-active-p)
     (buffer-substring-no-properties (region-beginning) (region-end)))
-   (t (or (format "\\_<%s\\_>" (thing-at-point 'symbol t))
-          (user-error "No substitution target at point")))))
+   (t
+    (if-let ((thing (thing-at-point 'symbol t)))
+        (format "\\_<%s\\_>" thing)
+      (user-error "No substitution target at point")))))
 
 (defmacro substitute-command (fn doc &optional scope)
   "Produce substitute command using FN, DOC, and SCOPE."

Reply via email to