fix beata crash

git-svn-id: http://svn.osgeo.org/qgis/trunk@10433 c8812cc2-4d05-0410-92ff-de0c093fc19c
This commit is contained in:
jef 2009-03-28 02:02:00 +00:00
parent 58605dc27f
commit 6a4ddd6476

View File

@ -105,9 +105,11 @@ void BeataModel::featureDeleted( int fid )
{ {
QgsDebugMsg( "entered." ); QgsDebugMsg( "entered." );
#ifdef QGISDEBUG
int idx = mIdRowMap[fid]; int idx = mIdRowMap[fid];
QgsDebugMsg( idx ); QgsDebugMsg( idx );
QgsDebugMsg( fid ); QgsDebugMsg( fid );
#endif
#if 0 #if 0
--mFeatureCount; --mFeatureCount;
@ -406,6 +408,9 @@ QVariant BeataModel::data( const QModelIndex &index, int role ) const
mLastRow = ( QgsAttributeMap * ) & mFeat.attributeMap(); mLastRow = ( QgsAttributeMap * ) & mFeat.attributeMap();
} }
if( !mLastRow )
return QVariant( "ERROR" );
QVariant& val = ( *mLastRow )[ mAttributes[index.column()] ]; QVariant& val = ( *mLastRow )[ mAttributes[index.column()] ];
if ( val.isNull() ) if ( val.isNull() )
@ -537,6 +542,9 @@ QVariant BeataMemModel::data( const QModelIndex &index, int role ) const
mLastRow = ( QgsAttributeMap * ) & mFeat.attributeMap(); mLastRow = ( QgsAttributeMap * ) & mFeat.attributeMap();
} }
if( !mLastRow )
return QVariant( "ERROR" );
QVariant &val = ( *mLastRow )[ mAttributes[index.column()] ]; QVariant &val = ( *mLastRow )[ mAttributes[index.column()] ];
if ( val.isNull() ) if ( val.isNull() )
@ -574,7 +582,7 @@ bool BeataMemModel::setData( const QModelIndex &index, const QVariant &value, in
{ {
mLastRowId = rowToId( index.row() ); mLastRowId = rowToId( index.row() );
mFeat = mFeatureMap[rowToId( index.row() )]; mFeat = mFeatureMap[rowToId( index.row() )];
mLastRow = ( QgsAttributeMap * )( &( mFeat.attributeMap() ) ); mLastRow = ( QgsAttributeMap * ) &mFeat.attributeMap();
// QgsDebugMsg(mFeatureMap[rowToId(index.row())].id()); // QgsDebugMsg(mFeatureMap[rowToId(index.row())].id());