From 890caf4e8e44971ae94bea72193560b8ae56aceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Thu, 25 Apr 2024 19:34:32 +0200 Subject: [PATCH] core: remove check of NULL pointers before calling gui_bar_item_free() (issue #865) --- src/gui/gui-bar-item-custom.c | 3 +-- tests/unit/gui/test-gui-bar-item.cpp | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/gui-bar-item-custom.c b/src/gui/gui-bar-item-custom.c index fac56ab40..8b86609b5 100644 --- a/src/gui/gui-bar-item-custom.c +++ b/src/gui/gui-bar-item-custom.c @@ -374,8 +374,7 @@ gui_bar_item_custom_alloc (const char *name) void gui_bar_item_custom_create_bar_item (struct t_gui_bar_item_custom *item) { - if (item->bar_item) - gui_bar_item_free (item->bar_item); + gui_bar_item_free (item->bar_item); item->bar_item = gui_bar_item_new ( NULL, item->name, diff --git a/tests/unit/gui/test-gui-bar-item.cpp b/tests/unit/gui/test-gui-bar-item.cpp index 557026e86..3b350398a 100644 --- a/tests/unit/gui/test-gui-bar-item.cpp +++ b/tests/unit/gui/test-gui-bar-item.cpp @@ -188,7 +188,8 @@ TEST(GuiBarItem, Update) TEST(GuiBarItem, Free) { - /* TODO: write tests */ + /* test free of NULL bar item */ + gui_bar_item_free (NULL); } /*