summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 );