From 83443ae2ffacb7801f469f234acc9136e5ec654d Mon Sep 17 00:00:00 2001 From: Magne Sjaastad Date: Thu, 22 Aug 2024 11:49:06 +0200 Subject: [PATCH] Guard use of empty OpenGL context --- .../ModelVisualization/RivWellSpheresPartMgr.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/ApplicationLibCode/ModelVisualization/RivWellSpheresPartMgr.cpp b/ApplicationLibCode/ModelVisualization/RivWellSpheresPartMgr.cpp index 58c43d47ed..9e04c755fb 100644 --- a/ApplicationLibCode/ModelVisualization/RivWellSpheresPartMgr.cpp +++ b/ApplicationLibCode/ModelVisualization/RivWellSpheresPartMgr.cpp @@ -178,11 +178,14 @@ cvf::ref RivWellSpheresPartMgr::createPart( std::vectorviewer() ) { - cvf::ref oglContext = m_rimReservoirView->viewer()->cvfOpenGLContext(); - cvf::OpenGLResourceManager* resourceManager = oglContext->resourceManager(); - cvf::ref vectorProgram = resourceManager->getLinkedVectorDrawerShaderProgram( oglContext.p() ); + cvf::ref oglContext = m_rimReservoirView->viewer()->cvfOpenGLContext(); + if ( oglContext.notNull() ) + { + cvf::OpenGLResourceManager* resourceManager = oglContext->resourceManager(); + cvf::ref vectorProgram = resourceManager->getLinkedVectorDrawerShaderProgram( oglContext.p() ); - eff->setShaderProgram( vectorProgram.p() ); + eff->setShaderProgram( vectorProgram.p() ); + } } }