summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKohei Yoshida <kyoshida@novell.com>2011-04-20 00:40:52 -0400
committerKohei Yoshida <kyoshida@novell.com>2011-04-20 00:42:36 -0400
commitb8502c8251b0760f1bf03c968974f1fe3f288ae2 (patch)
tree2872842084d371928a012359067c2aa7439f40c1
parentbd0fa243f0e4505649278a0ea9a5af182ecdfdb2 (diff)
fdo#36288: Fixed a crasher on Base.
The return type was probably unintentionally converted to sal_Int16 from sal_uInt16, and it didn't check for "column not found" condition.
-rw-r--r--svx/source/fmcomp/gridctrl.cxx7
1 files changed, 5 insertions, 2 deletions
diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index e6b050024d1d..580fa90f7b1c 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -1722,7 +1722,10 @@ sal_uInt16 DbGridControl::AppendColumn(const XubString& rName, sal_uInt16 nWidth
//------------------------------------------------------------------------------
void DbGridControl::RemoveColumn(sal_uInt16 nId)
{
- sal_Int16 nIndex = GetModelColumnPos(nId);
+ sal_uInt16 nIndex = GetModelColumnPos(nId);
+ if (nIndex == GRID_COLUMN_NOT_FOUND)
+ return;
+
DbGridControl_Base::RemoveColumn(nId);
delete m_aColumns[ nIndex ];
@@ -1737,7 +1740,7 @@ void DbGridControl::ColumnMoved(sal_uInt16 nId)
DbGridControl_Base::ColumnMoved(nId);
// remove the col from the model
- sal_Int16 nOldModelPos = GetModelColumnPos(nId);
+ sal_uInt16 nOldModelPos = GetModelColumnPos(nId);
#ifdef DBG_UTIL
DbGridColumn* pCol = m_aColumns[ (sal_uInt32)nOldModelPos ];
DBG_ASSERT(!pCol->IsHidden(), "DbGridControl::ColumnMoved : moved a hidden col ? how this ?");