diff --git a/src/osgUtil/GLObjectsVisitor.cpp b/src/osgUtil/GLObjectsVisitor.cpp index 820d1a6be..dce01090e 100644 --- a/src/osgUtil/GLObjectsVisitor.cpp +++ b/src/osgUtil/GLObjectsVisitor.cpp @@ -42,7 +42,7 @@ void GLObjectsVisitor::apply(osg::Node& node) traverse(node); - bool programSetAfter = _renderInfo.getState()->getLastAppliedProgramObject()!=0; + bool programSetAfter = _renderInfo.getState()!=0 && _renderInfo.getState()->getLastAppliedProgramObject()!=0; if (programSetBefore && !programSetAfter) { osg::State* state = _renderInfo.getState();