summaryrefslogtreecommitdiff
path: root/svx/source/fmcomp/gridctrl.cxx
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
commit06b6df6759929073e917ae0fa7e819407d3e2555 (patch)
tree75d6ea4ff2489c9c099d323b2a56d4f07bade949 /svx/source/fmcomp/gridctrl.cxx
parentdd9aa7f8fe68dd1627df252894c299b04a948ad2 (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.
Diffstat (limited to 'svx/source/fmcomp/gridctrl.cxx')
-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 a6d4458991..bb666bcca4 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 ?");