From: Alex Schroeder Date: Sun, 24 Apr 2022 11:33:09 +0000 (+0200) Subject: Fix error in rcirc for IRC tags without values X-Git-Tag: emacs-29.0.90~1931^2~292 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=516ff422c54b79099841bb59d34da467f3f9a34e;p=emacs.git Fix error in rcirc for IRC tags without values * src/lisp/net/rcirc.el (rcirc-process-server-response-1): If the optional value for a tag is not present, do not call replace-regexp-in-string on it. If (match-string 2 tag) is nil, the STRING argument for the replace-regexp-in-string is nil, which results in an error. --- diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 31888f39132..0d30b349229 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -1082,17 +1082,18 @@ Note that the messages are stored in reverse order.") ;; expression and `rcirc-process-regexp'. (error "Malformed tag %S" tag)) (cons (match-string 1 tag) - (replace-regexp-in-string - (rx (* ?\\ ?\\) ?\\ (any ?: ?s ?\\ ?r ?n)) - (lambda (rep) - (concat (substring rep 0 -2) - (cl-case (aref rep (1- (length rep))) - (?: ";") - (?s " ") - (?\\ "\\\\") - (?r "\r") - (?n "\n")))) - (match-string 2 tag)))) + (when (match-string 2 tag) + (replace-regexp-in-string + (rx (* ?\\ ?\\) ?\\ (any ?: ?s ?\\ ?r ?n)) + (lambda (rep) + (concat (substring rep 0 -2) + (cl-case (aref rep (1- (length rep))) + (?: ";") + (?s " ") + (?\\ "\\\\") + (?r "\r") + (?n "\n")))) + (match-string 2 tag))))) (split-string tag-data ";")))) rcirc-message-tags)) (user (match-string 3 text))