changeset 759:5f8fc01e01c7

Never blunder ahead without a document at this point! (Could happen if first model was opened using OSC)
author Chris Cannam
date Wed, 29 Apr 2020 17:48:20 +0100
parents 5b6655449ba6
children 3a63f1f61bd6
files framework/MainWindowBase.cpp
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/framework/MainWindowBase.cpp	Wed Apr 29 15:27:13 2020 +0100
+++ b/framework/MainWindowBase.cpp	Wed Apr 29 17:48:20 2020 +0100
@@ -1682,8 +1682,13 @@
         }
     }
 
+    if (mode != ReplaceSession && !m_document) {
+        SVDEBUG << "File open mode requested is something other than ReplaceSession, but we have no document at all yet, so we must use ReplaceSession mode" << endl;
+        mode = ReplaceSession;
+    }
+
     if (mode == CreateAdditionalModel && getMainModelId().isNone()) {
-        SVDEBUG << "Mode is CreateAdditionalModel but we have no main model, switching to ReplaceSession mode" << endl;
+        SVDEBUG << "File open mode requested is CreateAdditionalModel, but we have no main model, so switching to ReplaceSession mode" << endl;
         mode = ReplaceSession;
     }