add check, if insert item failed, then return null
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77822 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
fa2fa3dd9f
commit
55eed80313
@ -1160,6 +1160,8 @@ wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
|
|||||||
|
|
||||||
wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
||||||
{
|
{
|
||||||
|
bool result = false;
|
||||||
|
|
||||||
if ( item->GetKind() == wxITEM_RADIO )
|
if ( item->GetKind() == wxITEM_RADIO )
|
||||||
{
|
{
|
||||||
unsigned int start, end;
|
unsigned int start, end;
|
||||||
@ -1173,7 +1175,7 @@ wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
|||||||
// set this element as the first of radio group
|
// set this element as the first of radio group
|
||||||
item->SetAsRadioGroupStart();
|
item->SetAsRadioGroupStart();
|
||||||
item->SetRadioGroupEnd(m_startRadioGroup);
|
item->SetRadioGroupEnd(m_startRadioGroup);
|
||||||
wxMenuBase::DoInsert(pos, item);
|
result = wxMenuBase::DoInsert(pos, item);
|
||||||
item->Check(true);
|
item->Check(true);
|
||||||
}
|
}
|
||||||
else // extend the current radio group
|
else // extend the current radio group
|
||||||
@ -1210,11 +1212,14 @@ wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
|
|||||||
wxFAIL_MSG( wxT("where is the radio group start item?") );
|
wxFAIL_MSG( wxT("where is the radio group start item?") );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
wxMenuBase::DoInsert(pos, item);
|
result = wxMenuBase::DoInsert(pos, item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wxMenuBase::DoInsert(pos, item);
|
result = wxMenuBase::DoInsert(pos, item);
|
||||||
|
|
||||||
|
if ( !result )
|
||||||
|
return NULL;
|
||||||
|
|
||||||
OnItemAdded(item);
|
OnItemAdded(item);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user