From 6a4ddd6476355b6f6ef4796cfe97c104d453af20 Mon Sep 17 00:00:00 2001 From: jef Date: Sat, 28 Mar 2009 02:02:00 +0000 Subject: [PATCH] fix beata crash git-svn-id: http://svn.osgeo.org/qgis/trunk@10433 c8812cc2-4d05-0410-92ff-de0c093fc19c --- src/app/attributetable/BeataModel.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app/attributetable/BeataModel.cpp b/src/app/attributetable/BeataModel.cpp index 6b3a5fa925f..4b16fe16f91 100644 --- a/src/app/attributetable/BeataModel.cpp +++ b/src/app/attributetable/BeataModel.cpp @@ -105,9 +105,11 @@ void BeataModel::featureDeleted( int fid ) { QgsDebugMsg( "entered." ); +#ifdef QGISDEBUG int idx = mIdRowMap[fid]; QgsDebugMsg( idx ); QgsDebugMsg( fid ); +#endif #if 0 --mFeatureCount; @@ -406,6 +408,9 @@ QVariant BeataModel::data( const QModelIndex &index, int role ) const mLastRow = ( QgsAttributeMap * ) & mFeat.attributeMap(); } + if( !mLastRow ) + return QVariant( "ERROR" ); + QVariant& val = ( *mLastRow )[ mAttributes[index.column()] ]; if ( val.isNull() ) @@ -537,6 +542,9 @@ QVariant BeataMemModel::data( const QModelIndex &index, int role ) const mLastRow = ( QgsAttributeMap * ) & mFeat.attributeMap(); } + if( !mLastRow ) + return QVariant( "ERROR" ); + QVariant &val = ( *mLastRow )[ mAttributes[index.column()] ]; if ( val.isNull() ) @@ -574,7 +582,7 @@ bool BeataMemModel::setData( const QModelIndex &index, const QVariant &value, in { mLastRowId = rowToId( index.row() ); mFeat = mFeatureMap[rowToId( index.row() )]; - mLastRow = ( QgsAttributeMap * )( &( mFeat.attributeMap() ) ); + mLastRow = ( QgsAttributeMap * ) &mFeat.attributeMap(); // QgsDebugMsg(mFeatureMap[rowToId(index.row())].id());