From 439071dddfa71466de6839b3948eb4938bbe89f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacob=20St=C3=B8ren?= Date: Wed, 20 Nov 2019 09:04:39 +0100 Subject: [PATCH] Fix crash when copying the intersection. Updating of the default is handled later, so is not neccesary when doint initAfterRead after deserialization. --- .../ProjectDataModel/RimIntersectionHandle.cpp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/ApplicationCode/ProjectDataModel/RimIntersectionHandle.cpp b/ApplicationCode/ProjectDataModel/RimIntersectionHandle.cpp index 65e88e8adf..70b9de08c7 100644 --- a/ApplicationCode/ProjectDataModel/RimIntersectionHandle.cpp +++ b/ApplicationCode/ProjectDataModel/RimIntersectionHandle.cpp @@ -184,13 +184,17 @@ void RimIntersectionHandle::updateDefaultSeparateDataSource() if ( m_separateDataSource() == nullptr ) { RimGridView* view; - this->firstAncestorOrThisOfTypeAsserted( view ); + this->firstAncestorOrThisOfType( view ); - std::vector iResDefs = - view->separateIntersectionResultsCollection()->intersectionResultsDefinitions(); - if ( iResDefs.size() ) + if ( view ) { - m_separateDataSource = iResDefs[0]; + std::vector iResDefs = + view->separateIntersectionResultsCollection()->intersectionResultsDefinitions(); + + if ( iResDefs.size() ) + { + m_separateDataSource = iResDefs[0]; + } } } } @@ -203,6 +207,8 @@ cvf::ref RimIntersectionHandle::createHexGridIn RimIntersectionResultDefinition* resDef = activeSeparateResultDefinition(); if ( resDef && resDef->activeCase() ) { + // Eclipse case + RimEclipseCase* eclipseCase = dynamic_cast( resDef->activeCase() ); if ( eclipseCase && eclipseCase->eclipseCaseData() ) { @@ -212,6 +218,8 @@ cvf::ref RimIntersectionHandle::createHexGridIn this->isInactiveCellsVisible() ); } + // Geomech case + RimGeoMechCase* geomCase = dynamic_cast( resDef->activeCase() ); if ( geomCase && geomCase->geoMechData() && geomCase->geoMechData()->femParts() )