From Michael Platings, "the DAE importer was crashing when calling osg::Object::setName with a null pointer argument. Rather than trying to fix all the places this might happen and probably missing a few, I thought it would be better to trivially validate the input in setName. With this fix if setName is called with a null pointer then the name is cleared."

This commit is contained in:
Robert Osfield 2009-08-22 17:13:19 +00:00
parent a63dbc225e
commit c56dd6faa5

View File

@ -99,7 +99,11 @@ class OSG_EXPORT Object : public Referenced
inline void setName( const std::string& name ) { _name = name; } inline void setName( const std::string& name ) { _name = name; }
/** Set the name of object using a C style string.*/ /** Set the name of object using a C style string.*/
inline void setName( const char* name ) { _name = name; } inline void setName( const char* name )
{
if (name) _name = name;
else _name.clear();
}
/** Get the name of object.*/ /** Get the name of object.*/
inline const std::string& getName() const { return _name; } inline const std::string& getName() const { return _name; }