[Libreoffice-commits] .: Branch 'libreoffice-3-4' - svx/source

Kohei Yoshida kohei at kemper.freedesktop.org
Tue Apr 19 21:44:00 PDT 2011


 svx/source/fmcomp/gridctrl.cxx |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

New commits:
commit 06b6df6759929073e917ae0fa7e819407d3e2555
Author: Kohei Yoshida <kyoshida at novell.com>
Date:   Wed Apr 20 00:40:52 2011 -0400

    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.

diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index a6d4458..bb666bc 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 ?");


More information about the Libreoffice-commits mailing list