[PATCH 1/3] fdo#40701: DbGridControl::RemoveColumn even if no corresponding Model column

Lionel Elie Mamane lionel at mamane.lu
Sun Sep 11 15:00:33 PDT 2011


That case crops up when nId==0 i.e. the Handle column
---
 svx/source/fmcomp/gridctrl.cxx |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/svx/source/fmcomp/gridctrl.cxx b/svx/source/fmcomp/gridctrl.cxx
index bb666bc..aec3738 100644
--- a/svx/source/fmcomp/gridctrl.cxx
+++ b/svx/source/fmcomp/gridctrl.cxx
@@ -1723,11 +1723,12 @@ sal_uInt16 DbGridControl::AppendColumn(const XubString& rName, sal_uInt16 nWidth
 void DbGridControl::RemoveColumn(sal_uInt16 nId)
 {
     sal_uInt16 nIndex = GetModelColumnPos(nId);
-    if (nIndex == GRID_COLUMN_NOT_FOUND)
-        return;
 
     DbGridControl_Base::RemoveColumn(nId);
 
+    if (nIndex == GRID_COLUMN_NOT_FOUND)
+        return;
+
     delete m_aColumns[ nIndex ];
     DbGridColumns::iterator it = m_aColumns.begin();
     ::std::advance( it, nIndex );
-- 
1.7.2.5


--XsQoSWH+UP9D9v3l
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="0002-FmXGridPeer-getByIndex-Error-checking-of-pGrid-GetMo.patch"



More information about the LibreOffice mailing list