Fix crash on save project in console mode

This commit is contained in:
Kristian Bendiksen authored and Magne Sjaastad committed 2021-10-22 08:04:05 +02:00
1 parent 6b13a31349
commit b760404876
1 file changed
+8 -5
@@ -358,12 +358,15 @@ void RimProject::initAfterRead()
//--------------------------------------------------------------------------------------------------
void RimProject::setupBeforeSave()
{
RiaGuiApplication* guiApp = RiaGuiApplication::instance();
if ( guiApp )
if ( RiaGuiApplication::isRunning() )
{
m_show3DWindow = guiApp->mainWindow()->isVisible();
m_showPlotWindow = guiApp->mainPlotWindow() && guiApp->mainPlotWindow()->isVisible();
RiaGuiApplication* guiApp = RiaGuiApplication::instance();
if ( guiApp )
{
m_show3DWindow = guiApp->mainWindow()->isVisible();
m_showPlotWindow = guiApp->mainPlotWindow() && guiApp->mainPlotWindow()->isVisible();
}
}
m_projectFileVersionString = STRPRODUCTVER;