Thermal Fracture: guard for nullptrs for surface export.

This commit is contained in:
Kristian Bendiksen 2022-09-28 08:45:34 +02:00
parent 8ed349f859
commit 8193f24a55
3 changed files with 13 additions and 6 deletions

View File

@ -27,11 +27,13 @@
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
/// ///
//-------------------------------------------------------------------------------------------------- //--------------------------------------------------------------------------------------------------
bool RifThermalFractureTemplateSurfaceExporter::writeToFile( RimThermalFractureTemplate* fractureTemplate, bool RifThermalFractureTemplateSurfaceExporter::writeToFile( gsl::not_null<RimThermalFractureTemplate*> thermalFractureTemplate,
int timeStepIndex, int timeStepIndex,
const QString& filePath ) const QString& filePath )
{ {
auto fractureData = fractureTemplate->fractureDefinition(); auto fractureData = thermalFractureTemplate->fractureDefinition();
CAF_ASSERT( fractureData );
auto numNodes = fractureData->numNodes(); auto numNodes = fractureData->numNodes();
auto numTimeSteps = fractureData->numTimeSteps(); auto numTimeSteps = fractureData->numTimeSteps();
auto properties = fractureData->getPropertyNamesUnits(); auto properties = fractureData->getPropertyNamesUnits();

View File

@ -18,6 +18,8 @@
#pragma once #pragma once
#include <gsl/gsl>
class RimThermalFractureTemplate; class RimThermalFractureTemplate;
class QString; class QString;
@ -27,5 +29,7 @@ class QString;
class RifThermalFractureTemplateSurfaceExporter class RifThermalFractureTemplateSurfaceExporter
{ {
public: public:
static bool writeToFile( RimThermalFractureTemplate* stimPlanModel, int timeStep, const QString& filePath ); static bool writeToFile( gsl::not_null<RimThermalFractureTemplate*> thermalFractureTemplate,
int timeStep,
const QString& filePath );
}; };

View File

@ -45,7 +45,8 @@ RimcThermalFractureTemplate_exportToFile::RimcThermalFractureTemplate_exportToFi
caf::PdmObjectHandle* RimcThermalFractureTemplate_exportToFile::execute() caf::PdmObjectHandle* RimcThermalFractureTemplate_exportToFile::execute()
{ {
RimThermalFractureTemplate* thermalFracture = self<RimThermalFractureTemplate>(); RimThermalFractureTemplate* thermalFracture = self<RimThermalFractureTemplate>();
RifThermalFractureTemplateSurfaceExporter::writeToFile( thermalFracture, m_timeStep(), m_filePath() ); if ( thermalFracture && thermalFracture->fractureDefinition() )
RifThermalFractureTemplateSurfaceExporter::writeToFile( thermalFracture, m_timeStep(), m_filePath() );
return nullptr; return nullptr;
} }