summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2015-10-16 20:47:07 +0100
committerCaolán McNamara <caolanm@redhat.com>2015-10-17 14:46:27 +0100
commit6806a0260d76d9c8abdb41aa07d90fc264520f7c (patch)
tree07924aebff0edd00b010d4f3f18c8d641e8a676f
parente1bc0f42fa5d474ba153672ee33f2ddc004dd15b (diff)
coverity#1327442 Division or modulo by zero
Change-Id: I4046fa491cb59c93665a5584544ab1fbda7fa733
-rw-r--r--sw/source/ui/dbui/dbinsdlg.cxx5
1 files changed, 3 insertions, 2 deletions
diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx
index 0a48c570f1da..c9157bc58df3 100644
--- a/sw/source/ui/dbui/dbinsdlg.cxx
+++ b/sw/source/ui/dbui/dbinsdlg.cxx
@@ -734,11 +734,12 @@ IMPL_LINK_TYPED( SwInsertDBColAutoPilot, TableFormatHdl, Button*, pButton, void
::GetHtmlMode( pView->GetDocShell() )));
}
- if( m_pLbTableCol->GetEntryCount() != pRep->GetAllColCount() )
+ sal_Int32 nCols = m_pLbTableCol->GetEntryCount();
+ if (nCols != pRep->GetAllColCount() && nCols > 0)
{
// Number of columns has changed: then the TabCols have to be adjusted
long nWidth = pRep->GetWidth();
- const sal_Int32 nCols = m_pLbTableCol->GetEntryCount() - 1;
+ --nCols;
SwTabCols aTabCols( nCols );
aTabCols.SetRight( nWidth );
aTabCols.SetRightMax( nWidth );