From 578c0341da0c8dd6895cd4ab606ff4d2d6525f98 Mon Sep 17 00:00:00 2001 From: denes Date: Tue, 6 Mar 2018 10:29:29 +0100 Subject: [PATCH] no unpost_menu when item_count is 0 --- graph_browser.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/graph_browser.cpp b/graph_browser.cpp index 9ebb4bf..dab9f94 100644 --- a/graph_browser.cpp +++ b/graph_browser.cpp @@ -139,7 +139,8 @@ void GraphBrowser::cleanUp() ITEM** old_items = menu_items(menu_); const int old_items_count = item_count(menu_); - assert(unpost_menu(menu_) == E_OK); + if (old_items_count > 0) + assert(unpost_menu(menu_) == E_OK); assert(free_menu(menu_) == E_OK); for (int i = 0; i < old_items_count; ++i) assert(free_item(old_items[i]) == E_OK); @@ -307,8 +308,10 @@ void GraphBrowser::addItems(const std::vector& stringVector, bool f ITEM** old_items = menu_items(menu_); const int old_items_count = item_count(menu_); - const int u = unpost_menu(menu_); - assert (u == E_OK || first_run && u == E_NOT_POSTED); + if (old_items_count > 0) { + const int u = unpost_menu(menu_); + assert (u == E_OK || first_run && u == E_NOT_POSTED); + } const int number_of_new_items = stringVector.size(); ITEM** new_items = 0;