check tables width parameter for invalid values

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@53446 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2008-05-04 09:37:00 +00:00
parent 3f889a8168
commit 175fea401a

View File

@@ -281,17 +281,22 @@ void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag)
if (wd[wd.length()-1] == wxT('%')) if (wd[wd.length()-1] == wxT('%'))
{ {
wxSscanf(wd.c_str(), wxT("%i%%"), &m_ColsInfo[c].width); if ( wxSscanf(wd.c_str(), wxT("%i%%"), &m_ColsInfo[c].width) == 1 )
{
m_ColsInfo[c].units = wxHTML_UNITS_PERCENT; m_ColsInfo[c].units = wxHTML_UNITS_PERCENT;
} }
}
else else
{ {
wxSscanf(wd.c_str(), wxT("%i"), &m_ColsInfo[c].width); long width;
m_ColsInfo[c].width = (int)(m_PixelScale * (double)m_ColsInfo[c].width); if ( wd.ToLong(&width) )
{
m_ColsInfo[c].width = (int)(m_PixelScale * (double)width);
m_ColsInfo[c].units = wxHTML_UNITS_PIXELS; m_ColsInfo[c].units = wxHTML_UNITS_PIXELS;
} }
} }
} }
}
// spanning: // spanning: