Hi Lalit,

On 22/12/11 21:46 , Lalit Manchwari wrote:
> I am loading *.shp file in my program. In some files program works fine 
> (mostly shape
> file with lines) but in some other files program crashed.
> My code is :
> 
> osg::Geode* geode = dynamic_cast < osg::Geode* > 
> (osgDB::readNodeFile("Test.shp"));

You're making the assumption that the returned node always is a Geode.

This may not always be the case, e.g. because the loader decided to place a
MatrixTransform or a Group at the root of the loaded graph.  In these cases the
dynamic_cast will return a NULL pointer which would explain the crash.

Just use a osg::Node* and remove the dynamic_cast and you should be fine.

Cheers,
/ulrich
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to