diff framework/Document.cpp @ 68:cedeab01d4c8

* Attempt to fix finding of file:/// URLs * Fix incorrect reassignment of source model in layers that had no source model previously, when replacing a null main model
author Chris Cannam
date Thu, 29 Nov 2007 17:10:53 +0000
parents a8c8a9551a28
children 716e9d2f91c7
line wrap: on
line diff
--- a/framework/Document.cpp	Thu Nov 29 10:43:54 2007 +0000
+++ b/framework/Document.cpp	Thu Nov 29 17:10:53 2007 +0000
@@ -271,7 +271,7 @@
 //                  << (model ? model->objectName().toStdString() : "(null)") << " in layer "
 //                  << layer->objectName().toStdString() << std::endl;
 
-	if (model == oldMainModel) {
+	if (model && (model == oldMainModel)) {
 //            std::cerr << "... it uses the old main model, replacing" << std::endl;
 	    LayerFactory::getInstance()->setModel(layer, m_mainModel);
 	    continue;
@@ -285,7 +285,7 @@
 	    continue;
 	}
 	    
-	if (m_models[model].source == oldMainModel) {
+	if (m_models[model].source && (m_models[model].source == oldMainModel)) {
 
 //            std::cerr << "... it uses a model derived from the old main model, regenerating" << std::endl;
 
@@ -334,7 +334,8 @@
     }
 
     for (ModelMap::iterator i = m_models.begin(); i != m_models.end(); ++i) {
-        if (i->first->getAlignmentReference() == oldMainModel) {
+        if (oldMainModel &&
+            (i->first->getAlignmentReference() == oldMainModel)) {
             alignModel(i->first);
         }
     }