From ba03036a390c6dbcd18dbb7924ca844e54b5c3b8 Mon Sep 17 00:00:00 2001 From: Jari Vetoniemi Date: Sat, 25 Oct 2014 21:54:03 +0300 Subject: [PATCH] Store item pointer before removal. --- lib/menu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/menu.c b/lib/menu.c index 43de830..fe13276 100644 --- a/lib/menu.c +++ b/lib/menu.c @@ -288,10 +288,10 @@ bm_menu_remove_item_at(struct bm_menu *menu, uint32_t index) if (!menu->items.items || menu->items.count <= index) return 0; + struct bm_item *item = ((struct bm_item**)menu->items.items)[index]; bool ret = list_remove_item_at(&menu->items, index); if (ret) { - struct bm_item *item = ((struct bm_item**)menu->items.items)[index]; list_remove_item(&menu->selection, item); list_remove_item(&menu->filtered, item); }