Changeset 10487

Show
Ignore:
Timestamp:
07/16/09 13:49:37 (5 years ago)
Author:
robert
Message:

From Cedric Pinson, fix crash without error messages if the example does find the nathan.osg file.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osganimationtimeline/osganimationtimeline.cpp

    r9692 r10487  
    11/*  -*-c++-*-  
    2  *  Copyright (C) 2008 Cedric Pinson <mornifle@plopbyte.net> 
     2 *  Copyright (C) 2008 Cedric Pinson <cedric.pinson@plopbyte.net> 
    33 * 
    44 * This library is open source and may be redistributed and/or modified under   
     
    158158int main (int argc, char* argv[]) 
    159159{ 
    160     std::cerr << "This example works only with osgAnimation/nathan.osg" << std::endl; 
     160    std::cerr << "This example works only with nathan.osg" << std::endl; 
    161161 
    162162    osg::ArgumentParser psr(&argc, argv); 
     
    164164    osgViewer::Viewer viewer(psr); 
    165165 
    166     std::string file = "osgAnimation/nathan.osg"; 
     166    std::string file = "nathan.osg"; 
    167167    if(argc >= 2)  
    168168        file = psr[1]; 
     
    170170    // replace the manager 
    171171    osg::Group* root = dynamic_cast<osg::Group*>(osgDB::readNodeFile(file)); 
     172    if (!root) { 
     173        osg::notify(osg::FATAL) << "can't read file " << file << std::endl; 
     174        return 1; 
     175    } 
    172176    osgAnimation::AnimationManagerBase* animationManager = dynamic_cast<osgAnimation::AnimationManagerBase*>(root->getUpdateCallback()); 
    173177    if(!animationManager)  
    174178    { 
    175         std::cerr << "Did not find AnimationManagerBase updateCallback needed to animate elements" << std::endl; 
     179        osg::notify(osg::FATAL) << "Did not find AnimationManagerBase updateCallback needed to animate elements" << std::endl; 
    176180        return 1; 
    177181    }