From 43de7ca913a071a231cf6ca34ef3a609de498808 Mon Sep 17 00:00:00 2001 From: Lionel Elie Mamane Date: Sun, 11 Sep 2011 23:40:09 +0200 Subject: [PATCH 2/2] FmXGridPeer::getByIndex: Error checking of pGrid->GetModelColumnPos(nId) call 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