Skip to content

Commit 84435e6

Browse files
author
jef
committed
fix beata crash
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@10433 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 002d0d2 commit 84435e6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/app/attributetable/BeataModel.cpp

+9-1
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,11 @@ void BeataModel::featureDeleted( int fid )
105105
{
106106
QgsDebugMsg( "entered." );
107107

108+
#ifdef QGISDEBUG
108109
int idx = mIdRowMap[fid];
109110
QgsDebugMsg( idx );
110111
QgsDebugMsg( fid );
112+
#endif
111113

112114
#if 0
113115
--mFeatureCount;
@@ -406,6 +408,9 @@ QVariant BeataModel::data( const QModelIndex &index, int role ) const
406408
mLastRow = ( QgsAttributeMap * ) & mFeat.attributeMap();
407409
}
408410

411+
if( !mLastRow )
412+
return QVariant( "ERROR" );
413+
409414
QVariant& val = ( *mLastRow )[ mAttributes[index.column()] ];
410415

411416
if ( val.isNull() )
@@ -537,6 +542,9 @@ QVariant BeataMemModel::data( const QModelIndex &index, int role ) const
537542
mLastRow = ( QgsAttributeMap * ) & mFeat.attributeMap();
538543
}
539544

545+
if( !mLastRow )
546+
return QVariant( "ERROR" );
547+
540548
QVariant &val = ( *mLastRow )[ mAttributes[index.column()] ];
541549

542550
if ( val.isNull() )
@@ -574,7 +582,7 @@ bool BeataMemModel::setData( const QModelIndex &index, const QVariant &value, in
574582
{
575583
mLastRowId = rowToId( index.row() );
576584
mFeat = mFeatureMap[rowToId( index.row() )];
577-
mLastRow = ( QgsAttributeMap * )( &( mFeat.attributeMap() ) );
585+
mLastRow = ( QgsAttributeMap * ) &mFeat.attributeMap();
578586

579587

580588
// QgsDebugMsg(mFeatureMap[rowToId(index.row())].id());

0 commit comments

Comments
 (0)