Bug report #13221

Calling QgsFields.field( QString ) on nonexistent field crashes QGIS

Added by Spencer Gardner over 8 years ago. Updated over 8 years ago.

Status:Closed
Priority:Normal
Assignee:-
Category:-
Affected QGIS version:2.10.1 Regression?:No
Operating System: Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:21282

Description

Tested on latest QGIS 2.10 from source, Ubuntu 15.04
Steps to reproduce:
Create temporary scratch layer
Create new field "f"
Open Python console
Paste the following code:

l = iface.activeLayer()
fs = l.pendingFields()
f = fs.field('f')

Associated revisions

Revision 42d5b9b2
Added by Nyall Dawson over 8 years ago

Python exceptions for invalid keys in QgsFields methods (fix #13221)

History

#1 Updated by Spencer Gardner over 8 years ago

Apologies, the crashing code in the description should read:
l = iface.activeLayer()
fs = l.pendingFields()
f = fs.field('incorrect')

#2 Updated by Nyall Dawson over 8 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF