summaryrefslogtreecommitdiff
path: root/indra/newview/llspatialpartition.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llspatialpartition.cpp')
-rwxr-xr-xindra/newview/llspatialpartition.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/indra/newview/llspatialpartition.cpp b/indra/newview/llspatialpartition.cpp
index 45130efeb9..b9d4c016c2 100755
--- a/indra/newview/llspatialpartition.cpp
+++ b/indra/newview/llspatialpartition.cpp
@@ -841,11 +841,16 @@ void LLSpatialGroup::handleRemoval(const TreeNode* node, LLViewerOctreeEntry* en
void LLSpatialGroup::handleDestruction(const TreeNode* node)
{
+ if(isDead())
+ {
+ return;
+ }
setState(DEAD);
- for (element_iter i = getDataBegin(); i != getDataEnd(); ++i)
+ for (element_iter i = getDataBegin(); getElementCount() > 0 && i != getDataEnd();)
{
LLViewerOctreeEntry* entry = *i;
+
if (entry->getGroup() == this)
{
if(entry->hasDrawable())
@@ -853,10 +858,14 @@ void LLSpatialGroup::handleDestruction(const TreeNode* node)
((LLDrawable*)entry->getDrawable())->setGroup(NULL);
}
else
- {
+ {
llerrs << "No Drawable found in the entry." << llendl;
}
}
+ else
+ {
+ ++i;
+ }
}
//clean up avatar attachment stats