Skip to content

Commit

Permalink
fix r12869: if first feature has id 0 it wasn't retrieved
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@12871 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Feb 4, 2010
1 parent 957cd2a commit d2da7ed
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/app/attributetable/qgsattributetablemodel.cpp
Expand Up @@ -24,6 +24,7 @@


#include <QtGui> #include <QtGui>
#include <QVariant> #include <QVariant>
#include <limits>


//////////////////////////// ////////////////////////////
// QgsAttributeTableModel // // QgsAttributeTableModel //
Expand All @@ -32,6 +33,7 @@
QgsAttributeTableModel::QgsAttributeTableModel( QgsVectorLayer *theLayer, QObject *parent ) QgsAttributeTableModel::QgsAttributeTableModel( QgsVectorLayer *theLayer, QObject *parent )
: QAbstractTableModel( parent ) : QAbstractTableModel( parent )
{ {
mFeat.setFeatureId( std::numeric_limits<int>::min() );
mLayer = theLayer; mLayer = theLayer;
mFeatureCount = mLayer->pendingFeatureCount(); mFeatureCount = mLayer->pendingFeatureCount();
loadAttributes(); loadAttributes();
Expand Down Expand Up @@ -273,7 +275,7 @@ int QgsAttributeTableModel::rowToId( const int id ) const
{ {
QgsDebugMsg( QString( "rowToId: row %1 not in the map" ).arg( id ) ); QgsDebugMsg( QString( "rowToId: row %1 not in the map" ).arg( id ) );
// return negative infinite (to avoid collision with newly added features) // return negative infinite (to avoid collision with newly added features)
return -999999; return std::numeric_limits<int>::min();
} }


return mRowIdMap[id]; return mRowIdMap[id];
Expand Down

0 comments on commit d2da7ed

Please sign in to comment.