Bug report #11703

Add Invalid Layer to QgsLayerTreeGroup crashes QGIS 2.6

Added by Akbar Gumbira about 10 years ago. Updated almost 10 years ago.

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

Description

Hi, I know that this isn't the expected scenario. But if we feed QgsLayerTreeGroup with invalid layer, e.g just give it None, it will crash QGIS.

Simple script that can be run in QGIS Python Console :

a = QgsLayerTreeGroup()
a.addLayer(None)

I think throwing Exception is better than not handling it at all

Associated revisions

Revision f28a6d1d
Added by Martin Dobias almost 10 years ago

Fix #11703 and #11704

Do not create a layer node if the passed layer cannot be used (not in registry)

History

#1 Updated by Tim Sutton about 10 years ago

  • Assignee changed from Tim Sutton to Martin Dobias

#2 Updated by Martin Dobias almost 10 years ago

  • Status changed from Open to Closed

Also available in: Atom PDF