fix segfault with static item, supplement to 69ae7d89e3f179a4263abbadc6cc7951607a3854

Origin commit data
------------------
Commit: 9a638ac416
Author: Jacek Jendrzej <overx300@gmail.com>
Date: 2019-03-23 (Sat, 23 Mar 2019)
This commit is contained in:
Jacek Jendrzej
2019-03-23 11:33:50 +01:00
committed by vanhofen
parent b00722e264
commit d78d6b34e9

View File

@@ -778,8 +778,10 @@ void CMenuWidget::insertItem(const uint& item_id, CMenuItem* menuItem)
void CMenuWidget::removeItem(const uint& item_id)
{
delete items.at(item_id);
items.at(item_id) = NULL;
if(!items.at(item_id)->isStatic){
delete items.at(item_id);
items.at(item_id) = NULL;
}
items.erase(items.begin()+item_id);
if ((unsigned int) selected >= items.size())
selected = items.size() - 1;