From 0544e9c52e731ffa4d157918a5887620e1b4d008 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Deuc=D0=B5?= <shurd@sasktel.net>
Date: Thu, 4 May 2023 21:48:24 -0400
Subject: [PATCH] Handle all possible failure paths before calling
 bitmap_drv_init()

Should fix auto-curses mode crash.
---
 src/conio/x_events.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/conio/x_events.c b/src/conio/x_events.c
index 22c0d4b925..dc7cc50145 100644
--- a/src/conio/x_events.c
+++ b/src/conio/x_events.c
@@ -551,12 +551,12 @@ static int video_init()
 	if(load_vmode(&vstat, C80))
 		return(-1);
 	x_cvstat = vstat;
+	if(init_window())
+		return(-1);
 	bitmap_drv_init(x11_drawrect, x11_flush);
 	pthread_mutex_lock(&vstatlock);
 	bitmap_drv_init_mode(vstat.mode, NULL, NULL, 0, 0);
 	pthread_mutex_unlock(&vstatlock);
-	if(init_window())
-		return(-1);
 	init_mode_internal(x_cvstat.mode);
 
 	return(0);
-- 
GitLab