Bug report #12733
Layer order list corrupted if a layer reference can't be resolved
|Affected QGIS version:||2.8.1||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||20833|
If a project has a layer order that overrides the default rendering order and a layer reference can't be resolved during project load (e.g. due to a missing file) then the layer is removed, but leaves the layer order list in a corrupted state.
It looks like the list indexes are corrupted due to the reduced number of layers which are not taken into account.
One can test this through constructing a new project with a couple of layers, overriding the default layer order and then adding a raster layer in between. Then the project should be saved and the raster layer moved to a different name. Finally the project should be reloaded and you can see the corrupted layer order list.