emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 516ff422c5: Fix error in rcirc for IRC tags without values


From: Alex Schroeder
Subject: master 516ff422c5: Fix error in rcirc for IRC tags without values
Date: Tue, 26 Apr 2022 12:14:08 -0400 (EDT)

branch: master
commit 516ff422c54b79099841bb59d34da467f3f9a34e
Author: Alex Schroeder <alex@gnu.org>
Commit: Alex Schroeder <alex@gnu.org>

    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.
---
 lisp/net/rcirc.el | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index 31888f3913..0d30b34922 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))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]