Fix crash when opening attribute table on non-spatial layer

This commit is contained in:
Nyall Dawson 2015-08-05 15:00:40 +10:00
parent 2b8b942740
commit df4c1311ad
2 changed files with 2 additions and 2 deletions

View File

@ -798,7 +798,7 @@ class QgsVectorLayer : QgsMapLayer
*
* @return A list of fields
*/
const QgsFields fields() const;
QgsFields fields() const;
/**
* Returns the list of fields of this layer.

View File

@ -526,7 +526,7 @@ QVariant QgsAttributeTableModel::data( const QModelIndex &index, int role ) cons
if ( role == FieldIndexRole )
return fieldId;
const QgsField& field = layer()->fields()[ fieldId ];
const QgsField& field = layer()->fields().at( fieldId );
QVariant::Type fldType = field.type();
bool fldNumeric = ( fldType == QVariant::Int || fldType == QVariant::Double || fldType == QVariant::LongLong );