mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
Fix crash when opening attribute table on non-spatial layer
This commit is contained in:
parent
2b8b942740
commit
df4c1311ad
@ -798,7 +798,7 @@ class QgsVectorLayer : QgsMapLayer
|
|||||||
*
|
*
|
||||||
* @return A list of fields
|
* @return A list of fields
|
||||||
*/
|
*/
|
||||||
const QgsFields fields() const;
|
QgsFields fields() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the list of fields of this layer.
|
* Returns the list of fields of this layer.
|
||||||
|
@ -526,7 +526,7 @@ QVariant QgsAttributeTableModel::data( const QModelIndex &index, int role ) cons
|
|||||||
if ( role == FieldIndexRole )
|
if ( role == FieldIndexRole )
|
||||||
return fieldId;
|
return fieldId;
|
||||||
|
|
||||||
const QgsField& field = layer()->fields()[ fieldId ];
|
const QgsField& field = layer()->fields().at( fieldId );
|
||||||
|
|
||||||
QVariant::Type fldType = field.type();
|
QVariant::Type fldType = field.type();
|
||||||
bool fldNumeric = ( fldType == QVariant::Int || fldType == QVariant::Double || fldType == QVariant::LongLong );
|
bool fldNumeric = ( fldType == QVariant::Int || fldType == QVariant::Double || fldType == QVariant::LongLong );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user