Hi Torben & Mourad,

I have added a check against the getNodePath() being empty() to
computeNodeCenterAndRotation() method and checked it into svn/trunk.
The relevant code now looks like:

    osg::NodePath nodePath;
    if (_trackNodePath.getNodePath(nodePath) && !nodePath.empty())
        nodeCenter =
osg::Vec3d(nodePath.back()->getBound().center())*localToWorld;
    else
        nodeCenter = osg::Vec3d(0.0f,0.0f,0.0f)*localToWorld;

Could you let me know how you get on?

Robert.

On Fri, Feb 11, 2011 at 9:04 AM, Torben Dannhauer <[email protected]> wrote:
> Hi Robert,
>
> The stack trace is:
>
> Code:
>
>>       osg71-osgGAd.dll!std::_Vector_const_iterator<osg::Node 
>> *,std::allocator<osg::Node *> >::operator+=(int _Off=-1)  Zeile 161 + 0x60 
>> Bytes C++
>        osg71-osgGAd.dll!std::_Vector_iterator<osg::Node 
> *,std::allocator<osg::Node *> >::operator+=(int _Off=-1)  Zeile 376    C++
>        osg71-osgGAd.dll!std::_Vector_iterator<osg::Node 
> *,std::allocator<osg::Node *> >::operator-=(int _Off=1)  Zeile 388     C++
>        osg71-osgGAd.dll!std::_Vector_iterator<osg::Node 
> *,std::allocator<osg::Node *> >::operator-(int _Off=1)  Zeile 393 + 0xc Bytes 
>  C++
>        osg71-osgGAd.dll!std::vector<osg::Node *,std::allocator<osg::Node *> 
> >::back()  Zeile 800 + 0x2a Bytes  C++
>        
> osg71-osgGAd.dll!osgGA::NodeTrackerManipulator::computeNodeCenterAndRotation(osg::Vec3d
>  & nodeCenter={...}, osg::Quat & nodeRotation={...})  Zeile 171 + 0x12 Bytes  
>    C++
>
>
>
>
> It is caused in NodeTrackerManipulator::computeNodeCenterAndRotation(..):
>
> Code:
>
> nodeCenter = osg::Vec3d(nodePath.back()->getBound().center())*localToWorld;
>
>
>
>
> It Crashes because nodePath is empty, so nodePath.back does not work.
>
> Where is the best place to ensure that nodepath is not empty?
>
> Thank you!
>
> Cheers,
> Torben
>
> ------------------
> Read this topic online here:
> http://forum.openscenegraph.org/viewtopic.php?p=36544#36544
>
>
>
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to