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:
Vadim Zeitlin
2003-02-09 21:17:18 +00:00
parent 2b830c41f7
commit bc33be3b05

View File

@@ -1518,13 +1518,17 @@ wxFileConfigGroup *wxFileConfigGroup::AddSubgroup(const wxString& strName)
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
// other data structures.
bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup)
{
wxCHECK_MSG( pGroup, FALSE, _T("deleting non existing group?") );
wxLogTrace( _T("wxFileConfig"),
_T("Deleting group '%s' from '%s'"),
pGroup->Name().c_str(),
@@ -1539,11 +1543,8 @@ bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup)
_T(" text: '%s'"),
((m_pLine) ? m_pLine->Text().c_str() : wxEmptyString) );
wxCHECK_MSG( pGroup != 0, FALSE, _T("deleting non existing group?") );
// delete all entries
size_t nCount = pGroup->m_aEntries.Count();
// delete all entries
size_t nCount = pGroup->m_aEntries.Count();
wxLogTrace(_T("wxFileConfig"),
_T("Removing %lu Entries"),