Subject: Re: bug#56372: 29.0.50; [PATCH] Avoid BadMatch X11 error

From: dick <[email-masked]>
Date: Mon, 04 Jul 2022 00:50:09 -0400

>From 5d2442a836a5641f8f1c2b4a844fe510a77bd8c5 Mon Sep 17 00:00:00 2001
From: dickmao <[email-masked]>
Date: Mon, 4 Jul 2022 00:47:34 -0400
Subject: [PATCH] Avoid segfault

* src/xterm.c (x_connection_closed): Avoid segfault.
---
 src/xterm.c | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/src/xterm.c b/src/xterm.c
index c5acb450837..464887da975 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -23518,17 +23518,18 @@ x_connection_closed (Display *dpy, const char *error_message, bool ioerror)
 
 	  fprintf (stderr, "X error handlers currently installed:\n");
 
-	  for (failable = dpyinfo->failable_requests;
-	       failable < dpyinfo->next_failable_request;
-	       ++failable)
-	    {
-	      if (failable->end)
-		fprintf (stderr, "Ignoring errors between %lu to %lu\n",
-			 failable->start, failable->end);
-	      else
-		fprintf (stderr, "Ignoring errors from %lu onwards\n",
-			 failable->start);
-	    }
+	  if (dpyinfo)
+	    for (failable = dpyinfo->failable_requests;
+		 failable < dpyinfo->next_failable_request;
+		 ++failable)
+	      {
+		if (failable->end)
+		  fprintf (stderr, "Ignoring errors between %lu to %lu\n",
+			   failable->start, failable->end);
+		else
+		  fprintf (stderr, "Ignoring errors from %lu onwards\n",
+			   failable->start);
+	      }
 
 	  for (stack = x_error_message; stack; stack = stack->prev)
 	    fprintf (stderr, "Trapping errors from %lu\n",
-- 
2.36.1