Mercurial > hg > svapp
changeset 447:da520a68595a tonioni
When loading a session, do not import any layers for which the identified models can't be found
author | Chris Cannam |
---|---|
date | Tue, 31 Mar 2015 17:46:46 +0100 |
parents | 1c17a2c5e917 |
children | b36042cb972a |
files | framework/SVFileReader.cpp |
diffstat | 1 files changed, 8 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/framework/SVFileReader.cpp Tue Mar 31 17:27:28 2015 +0100 +++ b/framework/SVFileReader.cpp Tue Mar 31 17:46:46 2015 +0100 @@ -886,13 +886,18 @@ } else { cerr << "WARNING: SV-XML: Unknown model id " << modelId << " in layer definition" << endl; + + // Don't add a layer with an unknown model id + m_document->deleteLayer(layer); + m_layers[id] = layer = 0; + return false; } } - layer->setProperties(attributes); + if (layer) layer->setProperties(attributes); } - if (!m_inData && m_currentPane) { + if (!m_inData && m_currentPane && layer) { QString visible = attributes.value("visible"); bool dormant = (visible == "false"); @@ -912,7 +917,7 @@ } m_currentLayer = layer; - m_inLayer = true; + m_inLayer = (layer != 0); return true; }