SL-17244 Fix 'empty leaf' crashes

master
Andrey Kleshchev 2022-05-05 19:41:56 +03:00
parent f3add82a4c
commit 43517c5adc
3 changed files with 12 additions and 6 deletions

View File

@ -73,7 +73,7 @@ template <class T>
class LLOctreeTravelerDepthFirst : public LLOctreeTraveler<T>
{
public:
virtual void traverse(const LLOctreeNode<T>* node);
virtual void traverse(const LLOctreeNode<T>* node) override;
};
template <class T>
@ -696,7 +696,7 @@ public:
{
}
bool balance()
bool balance() override
{
//LL_PROFILE_ZONE_NAMED_COLOR("Octree::balance()",OCTREE_DEBUG_COLOR_BALANCE);
@ -732,7 +732,7 @@ public:
}
// LLOctreeRoot::insert
bool insert(T* data)
bool insert(T* data) override
{
if (data == NULL)
{
@ -835,6 +835,12 @@ public:
return false;
}
bool isLeaf() const override
{
// root can't be a leaf
return false;
}
};
//========================

View File

@ -414,7 +414,7 @@ public:
max.setMax(max, *tri->mV[2]);
}
}
else if (!branch->isLeaf())
else if (branch->getChildCount() > 0)
{ //no data, but child nodes exist
LLVolumeOctreeListener* child = (LLVolumeOctreeListener*) branch->getChild(0)->getListener(0);
@ -424,7 +424,7 @@ public:
}
else
{
LL_ERRS() << "Empty leaf" << LL_ENDL;
llassert(!branch->isLeaf()); // Empty leaf
}
for (S32 i = 0; i < branch->getChildCount(); ++i)

View File

@ -564,7 +564,7 @@ void LLViewerOctreeGroup::rebound()
group->setState(SKIP_FRUSTUM_CHECK);
}
else if (mOctreeNode->isLeaf())
else if (mOctreeNode->getChildCount() == 0)
{ //copy object bounding box if this is a leaf
boundObjects(TRUE, mExtents[0], mExtents[1]);
mBounds[0] = mObjectBounds[0];