From 6806a0260d76d9c8abdb41aa07d90fc264520f7c Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Fri, 16 Oct 2015 20:47:07 +0100 Subject: coverity#1327442 Division or modulo by zero Change-Id: I4046fa491cb59c93665a5584544ab1fbda7fa733 --- sw/source/ui/dbui/dbinsdlg.cxx | 5 +++-- 1 file 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 ); -- cgit v1.2.3