From 4157f43f4b50570160805a203e38130418f14381 Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sat, 15 Jan 2000 16:40:33 +0000 Subject: [PATCH] fixed my previous commit that broke help context/index parser :-( git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@5423 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/html/helpdata.cpp | 41 +++++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 10 deletions(-) diff --git a/src/html/helpdata.cpp b/src/html/helpdata.cpp index f7e74cb957..608c35eea9 100644 --- a/src/html/helpdata.cpp +++ b/src/html/helpdata.cpp @@ -122,16 +122,37 @@ bool HP_TagHandler::HandleTag(const wxHtmlTag& tag) m_Name = m_Page = wxEmptyString; ParseInner(tag); - if (m_ItemsCnt % wxHTML_REALLOC_STEP == 0) - m_Items = (wxHtmlContentsItem*) realloc(m_Items, (m_ItemsCnt + wxHTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem)); - m_Items[m_ItemsCnt].m_Level = m_Level; - m_Items[m_ItemsCnt].m_ID = m_ID; - m_Items[m_ItemsCnt].m_Page = new wxChar[m_Page.Length() + 1]; - wxStrcpy(m_Items[m_ItemsCnt].m_Page, m_Page.c_str()); - m_Items[m_ItemsCnt].m_Name = new wxChar [m_Name.Length() + 1]; - wxStrcpy(m_Items[m_ItemsCnt].m_Name, m_Name.c_str()); - m_Items[m_ItemsCnt].m_Book = m_Book; - m_ItemsCnt++; + if (!m_Page.IsEmpty()) + /* should be 'if (tag.GetParam("TYPE") == "text/sitemap")' + but this works fine. Valid HHW's file may contain only two + object tags: + + + + + + or + + + + + + + We're interested in the latter. !m_Page.IsEmpty() is valid + condition because text/site properties does not contain Local param + */ + { + if (m_ItemsCnt % wxHTML_REALLOC_STEP == 0) + m_Items = (wxHtmlContentsItem*) realloc(m_Items, (m_ItemsCnt + wxHTML_REALLOC_STEP) * sizeof(wxHtmlContentsItem)); + m_Items[m_ItemsCnt].m_Level = m_Level; + m_Items[m_ItemsCnt].m_ID = m_ID; + m_Items[m_ItemsCnt].m_Page = new wxChar[m_Page.Length() + 1]; + wxStrcpy(m_Items[m_ItemsCnt].m_Page, m_Page.c_str()); + m_Items[m_ItemsCnt].m_Name = new wxChar [m_Name.Length() + 1]; + wxStrcpy(m_Items[m_ItemsCnt].m_Name, m_Name.c_str()); + m_Items[m_ItemsCnt].m_Book = m_Book; + m_ItemsCnt++; + } return TRUE; } -- 2.45.2