Bug report #6791

crash adding features to OGR layers if any attribute index is missing in the layer

Added by Giuseppe Sucameli about 12 years ago. Updated about 12 years ago.

Status:Closed
Priority:Normal
Assignee:Giuseppe Sucameli
Category:Data Provider
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 #:15939

Description

Here's the snippet to reproduce it.

feat = QgsFeature()
feat.setAttributeMap( {"pk" : "1000000"} )

layer = self.iface.activeLayer()

layer.startEditing()
layer.addFeature( feat )
layer.commitChanges()

Ok, the crash depends on the wrong attribute map key which is a string instead of the integer index of the field, I know.
But this cause bindings convert the string to -1 which is passed as attribute index to the OGR library...

Associated revisions

Revision 1a7ccd01
Added by Giuseppe Sucameli about 12 years ago

fix crash adding features containing missing attributes (fix #6791)

History

#1 Updated by Giuseppe Sucameli about 12 years ago

  • Status changed from In Progress to Closed

Also available in: Atom PDF