From a7b21fa64734c847d5ab628a2f6e2e609b8eb298 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Thu, 25 Apr 2024 19:36:50 +0200 Subject: [PATCH] core: remove check of NULL pointers before calling gui_bar_window_free() (issue #865) --- src/gui/gui-bar.c | 3 +-- tests/unit/gui/test-gui-bar-window.cpp | 4 +++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/gui/gui-bar.c b/src/gui/gui-bar.c index 03c03932b..e7fc5a5d4 100644 --- a/src/gui/gui-bar.c +++ b/src/gui/gui-bar.c @@ -842,8 +842,7 @@ gui_bar_config_change_hidden (const void *pointer, void *data, { if (CONFIG_BOOLEAN(ptr_bar->options[GUI_BAR_OPTION_HIDDEN])) { - if (ptr_bar->bar_window) - gui_bar_window_free (ptr_bar->bar_window, NULL); + gui_bar_window_free (ptr_bar->bar_window, NULL); } else { diff --git a/tests/unit/gui/test-gui-bar-window.cpp b/tests/unit/gui/test-gui-bar-window.cpp index 075f8eff1..568bf5d4c 100644 --- a/tests/unit/gui/test-gui-bar-window.cpp +++ b/tests/unit/gui/test-gui-bar-window.cpp @@ -382,7 +382,9 @@ TEST(GuiBarWindow, SetCurrentSize) TEST(GuiBarWindow, Free) { - /* TODO: write tests */ + /* test free of NULL bar window */ + gui_bar_window_free (NULL, gui_current_window); + gui_bar_window_free (NULL, NULL); } /*