Added handling of the possibility of null Options pointers
This commit is contained in:
parent
0876677fb2
commit
e3c48d9f45
@ -18,7 +18,22 @@ using namespace osgDB;
|
||||
|
||||
bool ObjectCache::ClassComp::operator() (const ObjectCache::FileNameOptionsPair& lhs, const ObjectCache::FileNameOptionsPair& rhs) const
|
||||
{
|
||||
return lhs.first < rhs.first || *lhs.second < *rhs.second;
|
||||
// check if filename are the same
|
||||
if (lhs.first < rhs.first) return true;
|
||||
if (rhs.first < lhs.first) return false;
|
||||
|
||||
// check if Options pointers are the same.
|
||||
if (lhs.second == rhs.second) return false;
|
||||
|
||||
// need to compare Options pointers
|
||||
if (lhs.second.valid() && rhs.second.valid())
|
||||
{
|
||||
// lhs & rhs have valid Options objects
|
||||
return *lhs.second < *rhs.second;
|
||||
}
|
||||
|
||||
// finally use pointer comparison, expecting at least one will be NULL pointer
|
||||
return lhs.second < rhs.second;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user