# HG changeset patch # User Chris Cannam # Date 1427820406 -3600 # Node ID da520a68595a983bd206c01463549858e3389286 # Parent 1c17a2c5e9177f4ad64f3916569b236696aef5f1 When loading a session, do not import any layers for which the identified models can't be found diff -r 1c17a2c5e917 -r da520a68595a framework/SVFileReader.cpp --- 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; }