diff --git a/ApplicationLibCode/ProjectDataModel/Surfaces/RimFileSurface.cpp b/ApplicationLibCode/ProjectDataModel/Surfaces/RimFileSurface.cpp index d82e4cc451..d4e4faef74 100644 --- a/ApplicationLibCode/ProjectDataModel/Surfaces/RimFileSurface.cpp +++ b/ApplicationLibCode/ProjectDataModel/Surfaces/RimFileSurface.cpp @@ -120,11 +120,13 @@ void RimFileSurface::fieldChangedByUi( const caf::PdmFieldHandle* changedField, bool RimFileSurface::updateSurfaceData() { bool result = true; - if ( m_triangleMeshData->geometry().first.empty() ) + if ( !m_triangleMeshData || m_triangleMeshData->geometry().first.empty() ) { result = loadDataFromFile(); } + if ( !m_triangleMeshData ) return false; + auto [vertices, tringleIndices] = m_triangleMeshData->geometry(); auto surface = new RigSurface;