mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-22 07:06:13 +00:00
Avoid crashing if interface file is not at the good version
--HG-- branch : item_group
This commit is contained in:
parent
332a2b5a74
commit
db3271289d
1 changed files with 8 additions and 6 deletions
|
@ -203,11 +203,12 @@ void CItemGroupManager::linkInterface()
|
|||
CGroupSubMenu *pMenu = pRootMenu->getRootMenu();
|
||||
//get item subgroup
|
||||
CGroupMenu *pGroupMenu = dynamic_cast<CGroupMenu*>(pWM->getElementFromId("ui:interface:item_menu_in_bag:item_group_menu"));
|
||||
CGroupSubMenu *pGroupSubMenu = pGroupMenu->getRootMenu();
|
||||
if(pMenu && pGroupSubMenu)
|
||||
CGroupSubMenu *pGroupSubMenu = NULL;
|
||||
if (pGroupMenu) pGroupSubMenu = pGroupMenu->getRootMenu();
|
||||
if (pMenu && pGroupSubMenu)
|
||||
pMenu->setSubMenu(pMenu->getNumLine() - 1, pGroupSubMenu);
|
||||
else
|
||||
nlwarning("Couldn't link group action to group menu, interface isn't initialize yet ?");
|
||||
nlwarning("Couldn't link group submenu to item_menu_in_bag, check your widgets.xml file");
|
||||
}
|
||||
|
||||
void CItemGroupManager::uninit()
|
||||
|
@ -222,9 +223,10 @@ void CItemGroupManager::unlinkInterface()
|
|||
// We need to unlink our menu to avoid crash on interface release
|
||||
CWidgetManager* pWM = CWidgetManager::getInstance();
|
||||
CGroupMenu *pGroupMenu = dynamic_cast<CGroupMenu*>(pWM->getElementFromId("ui:interface:item_menu_in_bag:item_group_menu"));
|
||||
CGroupSubMenu *pGroupSubMenu = pGroupMenu->getRootMenu();
|
||||
pGroupMenu->reset();
|
||||
pGroupMenu->delGroup(pGroupSubMenu, true);
|
||||
CGroupSubMenu *pGroupSubMenu = NULL;
|
||||
if (pGroupMenu) pGroupSubMenu = pGroupMenu->getRootMenu();
|
||||
if (pGroupMenu) pGroupMenu->reset();
|
||||
if (pGroupMenu && pGroupSubMenu) pGroupMenu->delGroup(pGroupSubMenu, true);
|
||||
}
|
||||
|
||||
// Inspired from macro parsing
|
||||
|
|
Loading…
Reference in a new issue