From: Vadim Zeitlin Date: Sun, 17 Oct 2004 00:05:21 +0000 (+0000) Subject: fixed bug with adding new entries to a root group with subgroups but without any... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0da888ae90df3e86180eb03c1203a424c66153ab fixed bug with adding new entries to a root group with subgroups but without any existing entries git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29928 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/common/fileconf.cpp b/src/common/fileconf.cpp index 7fcaadeb5d..afb7f15282 100644 --- a/src/common/fileconf.cpp +++ b/src/common/fileconf.cpp @@ -1836,8 +1836,20 @@ void wxFileConfigEntry::SetValue(const wxString& strValue, bool bUser) } else // this entry didn't exist in the local file { - // add a new line to the file + // add a new line to the file: note the hack for the root group + // which is special in that it doesn't have its own group line + // (something like "[/]") and so the line we get for it may be not + // its line at all if it doesn't have any entries + // + // this is definitely not the right place to fix it but changing + // the root group to have NULL m_pLine will probably break too + // much stuff elsewhere so I don't dare to do it... wxFileConfigLineList *line = Group()->GetLastEntryLine(); + if ( !Group()->Parent() && line == Group()->GetGroupLine() ) + { + // prepend the first root group entry to the head of the list + line = NULL; + } m_pLine = Group()->Config()->LineListInsert(strLine, line); Group()->SetLastEntry(this);