From edc755c2a316694864bf213b1d1c4c13e4daf2d9 Mon Sep 17 00:00:00 2001
From: Marko Lindqvist <cazfi74@gmail.com>
Date: Sat, 7 Nov 2026 15:13:09 +0200
Subject: [PATCH 65/65] gtk: Correct senseless gui_dialog check

Check that pointer storage is not NULL,
instead of the pointer itself, before trying
to assign NULL to the pointer.
The pointer storage should never be NULL,
so this check is expected to be redundant anyway.

See RM #2446

Signed-off-by: Marko Lindqvist <cazfi74@gmail.com>
---
 client/gui-gtk-3.22/gui_stuff.c | 2 +-
 client/gui-gtk-4.0/gui_stuff.c  | 2 +-
 client/gui-gtk-5.0/gui_stuff.c  | 4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/client/gui-gtk-3.22/gui_stuff.c b/client/gui-gtk-3.22/gui_stuff.c
index cbb07d7c48..c4599816f9 100644
--- a/client/gui-gtk-3.22/gui_stuff.c
+++ b/client/gui-gtk-3.22/gui_stuff.c
@@ -339,7 +339,7 @@ static void gui_dialog_destroy_handler(GtkWidget *w, struct gui_dialog *dlg)
 
   g_object_unref(dlg->gui_button);
 
-  if (*(dlg->source)) {
+  if (dlg->source != NULL) {
     *(dlg->source) = NULL;
   }
 
diff --git a/client/gui-gtk-4.0/gui_stuff.c b/client/gui-gtk-4.0/gui_stuff.c
index 67416abaae..5dd68c8b76 100644
--- a/client/gui-gtk-4.0/gui_stuff.c
+++ b/client/gui-gtk-4.0/gui_stuff.c
@@ -895,7 +895,7 @@ void gui_dialog_destroy(struct gui_dialog *dlg)
     break;
   }
 
-  if (*(dlg->source)) {
+  if (dlg->source != NULL) {
     *(dlg->source) = NULL;
   }
 }
diff --git a/client/gui-gtk-5.0/gui_stuff.c b/client/gui-gtk-5.0/gui_stuff.c
index 51b3604d74..656ba4c225 100644
--- a/client/gui-gtk-5.0/gui_stuff.c
+++ b/client/gui-gtk-5.0/gui_stuff.c
@@ -896,8 +896,8 @@ void gui_dialog_destroy(struct gui_dialog *dlg)
     break;
   }
 
-  if (*(dlg->source)) {
-    *(dlg->source) = NULL;
+  if (dlg->source != nullptr) {
+    *(dlg->source) = nullptr;
   }
 }
 
-- 
2.53.0

