don't trigger an assert in wxFileConfigGroup::DeleteSubgroupByName() if the group doesn't exist
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19163 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1518,13 +1518,17 @@ wxFileConfigGroup *wxFileConfigGroup::AddSubgroup(const wxString& strName)
|
|||||||
|
|
||||||
bool wxFileConfigGroup::DeleteSubgroupByName(const wxChar *szName)
|
bool wxFileConfigGroup::DeleteSubgroupByName(const wxChar *szName)
|
||||||
{
|
{
|
||||||
return DeleteSubgroup(FindSubgroup(szName));
|
wxFileConfigGroup * const pGroup = FindSubgroup(szName);
|
||||||
|
|
||||||
|
return pGroup ? DeleteSubgroup(pGroup) : FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Delete the subgroup and remove all references to it from
|
// Delete the subgroup and remove all references to it from
|
||||||
// other data structures.
|
// other data structures.
|
||||||
bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup)
|
bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup)
|
||||||
{
|
{
|
||||||
|
wxCHECK_MSG( pGroup, FALSE, _T("deleting non existing group?") );
|
||||||
|
|
||||||
wxLogTrace( _T("wxFileConfig"),
|
wxLogTrace( _T("wxFileConfig"),
|
||||||
_T("Deleting group '%s' from '%s'"),
|
_T("Deleting group '%s' from '%s'"),
|
||||||
pGroup->Name().c_str(),
|
pGroup->Name().c_str(),
|
||||||
@@ -1539,10 +1543,7 @@ bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup)
|
|||||||
_T(" text: '%s'"),
|
_T(" text: '%s'"),
|
||||||
((m_pLine) ? m_pLine->Text().c_str() : wxEmptyString) );
|
((m_pLine) ? m_pLine->Text().c_str() : wxEmptyString) );
|
||||||
|
|
||||||
wxCHECK_MSG( pGroup != 0, FALSE, _T("deleting non existing group?") );
|
|
||||||
|
|
||||||
// delete all entries
|
// delete all entries
|
||||||
|
|
||||||
size_t nCount = pGroup->m_aEntries.Count();
|
size_t nCount = pGroup->m_aEntries.Count();
|
||||||
|
|
||||||
wxLogTrace(_T("wxFileConfig"),
|
wxLogTrace(_T("wxFileConfig"),
|
||||||
|
Reference in New Issue
Block a user