Problem with empty values in getFeatures with OrderBy #24537
Labels
Bug
Either a bug report, or a bug fix. Let's hope for the latter!
Expressions
Related to the QGIS expression engine or specific expression functions
Author Name: Marcos Medeiros (Marcos Medeiros)
Original Redmine Issue: 16637
Affected QGIS version: 2.16.1
Redmine category:expressions
I am trying to display features list on my own QAbstractTableModel.
By now it can sort columns just fine when all rows contains data. But whenever the column contains NULL/empty values the QgsVectorLayer::getFeatures method crash the application.
Code:
QgsFeatureRequest req;
req.addOrderBy(mLayer->attributeDisplayName(column), order == Qt::AscendingOrder);
QgsFeatureIterator it = mLayer->getFeatures(req);
QgsFeature feature;
long row = 0;
while (it.nextFeature(feature)) {
mRowToFeatureId[row++] = feature.id();
}
The text was updated successfully, but these errors were encountered: