]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix error in rcirc for IRC tags without values
authorAlex Schroeder <alex@gnu.org>
Sun, 24 Apr 2022 11:33:09 +0000 (13:33 +0200)
committerAlex Schroeder <alex@gnu.org>
Tue, 26 Apr 2022 16:13:50 +0000 (18:13 +0200)
* 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.

lisp/net/rcirc.el

index 31888f391324f233b0f0147a4b2f4f8f64789e1c..0d30b349229dccce00e0d3e95dace3e8e58c035e 100644 (file)
@@ -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))