Bug report #7772
crash while setting attributes of a new feature
Status: | Closed | ||
---|---|---|---|
Priority: | Severe/Regression | ||
Assignee: | - | ||
Category: | Vectors | ||
Affected QGIS version: | master | Regression?: | No |
Operating System: | Easy fix?: | No | |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 16668 |
Description
The following code crashes at setting the arrtirbute
fields = layer.dataProvider().fields() f = QgsFeature() f.setFields(fields) for field in fields: f[field.name()] = QVariant("1")
Using QVariant or not.
Associated revisions
[Fix #7772] Check attribute index before setting attribute to avoid crash
History
#1 Updated by Denis Rouzaud over 11 years ago
using initAttributes(fieldCount) after setFields works and prevent the crash.
#2 Updated by Matthias Kuhn over 11 years ago
- Status changed from Open to Closed
Fixed in changeset 524e142e1178cfd50fbeb3b178fe26c2818b3fe3.