Kaydet (Commit) 04343704 authored tarafından Caolán McNamara's avatar Caolán McNamara

coverity#1000600 Division or modulo by zero

Change-Id: I38fb8a7072eb7905f5dccc8697b3176d8b34c6c2
üst 1f6aefcf
...@@ -787,12 +787,19 @@ void DomainMapperTableManager::endOfRowAction() ...@@ -787,12 +787,19 @@ void DomainMapperTableManager::endOfRowAction()
for (sal_uInt32 i = 0; i < pCellWidths->size(); ++i) for (sal_uInt32 i = 0; i < pCellWidths->size(); ++i)
nFullWidthRelative += (*pCellWidths.get())[i]; nFullWidthRelative += (*pCellWidths.get())[i];
for (sal_uInt32 i = 0; i < pCellWidths->size() - 1; ++i) size_t nWidthsBound = pCellWidths->size() - 1;
if (nWidthsBound)
{ {
nSum += (*pCellWidths.get())[i]; if (nFullWidthRelative == 0)
pSeparators[nPos].Position = (nSum * 10000) / nFullWidthRelative; // Relative position throw std::range_error("divide by zero");
pSeparators[nPos].IsVisible = sal_True;
nPos++; for (sal_uInt32 i = 0; i < nWidthsBound; ++i)
{
nSum += (*pCellWidths.get())[i];
pSeparators[nPos].Position = (nSum * 10000) / nFullWidthRelative; // Relative position
pSeparators[nPos].IsVisible = sal_True;
nPos++;
}
} }
TablePropertyMapPtr pPropMap( new TablePropertyMap ); TablePropertyMapPtr pPropMap( new TablePropertyMap );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment