[PATCH 2/2] FmXGridPeer::getByIndex: Error checking of pGrid->GetModelColumnPos(nId) call

Lionel Elie Mamane lionel at mamane.lu
Sun Sep 11 14:40:09 PDT 2011


Fixes crash of fdo#40701, but not broken feature
---
 svx/source/fmcomp/fmgridif.cxx |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/svx/source/fmcomp/fmgridif.cxx b/svx/source/fmcomp/fmgridif.cxx
index 3080d77..a4146a9 100644
--- a/svx/source/fmcomp/fmgridif.cxx
+++ b/svx/source/fmcomp/fmgridif.cxx
@@ -2442,6 +2442,9 @@ Any FmXGridPeer::getByIndex(sal_Int32 _nIndex) throw( IndexOutOfBoundsException,
     // get the list position
     sal_uInt16 nPos = pGrid->GetModelColumnPos(nId);
 
+    if ( nPos == GRID_COLUMN_NOT_FOUND )
+        return aElement;
+
     DbGridColumn* pCol = pGrid->GetColumns().at( nPos );
     Reference< ::com::sun::star::awt::XControl >  xControl(pCol->GetCell());
     aElement <<= xControl;
-- 
1.7.2.5


--x+6KMIRAuhnl3hBn--


More information about the LibreOffice mailing list