From: <sv...@ww...> - 2007-07-21 17:05:26
|
Author: mkrose Date: 2007-07-21 10:04:25 -0700 (Sat, 21 Jul 2007) New Revision: 2138 Modified: trunk/csp/cspsim/VirtualScene.cpp Log: Fix occasional segv on startup. Browse at: https://www.zerobar.net/viewcvs/viewcvs.cgi?view=rev&rev=2138 Modified: trunk/csp/cspsim/VirtualScene.cpp =================================================================== --- trunk/csp/cspsim/VirtualScene.cpp 2007-07-10 20:21:47 UTC (rev 2137) +++ trunk/csp/cspsim/VirtualScene.cpp 2007-07-21 17:04:25 UTC (rev 2138) @@ -793,10 +793,12 @@ //XXX--m_FogColor = m_Sky->getHorizonColor(angle); float angle = atan2(dir.y(), dir.x()); m_FogColor = m_Sky->getSkyDome()->getHorizonColor(angle); - pFogAttr->setColor(m_FogColor); - pFogAttr->setStart(m_FogStart * (1.0 + a) + clearSky); - pFogAttr->setEnd(m_FogEnd); - pStateSet->setAttributeAndModes(pFogAttr, osg::StateAttribute::ON); + if (pFogAttr != NULL) { // TODO why is pFogAttr NULL at startup? + pFogAttr->setColor(m_FogColor); + pFogAttr->setStart(m_FogStart * (1.0 + a) + clearSky); + pFogAttr->setEnd(m_FogEnd); + pStateSet->setAttributeAndModes(pFogAttr, osg::StateAttribute::ON); + } m_FogGroup->setStateSet(pStateSet); //XXX--m_Sky->updateHorizon(m_FogColor, eyePos.z(), m_ViewDistance); } |