Commit 384e85f8 authored by Rye Mutt's avatar Rye Mutt 🍞
Browse files

Crash fixes from FS

parent 92d84b56
......@@ -403,13 +403,17 @@ void LLFace::switchTexture(U32 ch, LLViewerTexture* new_texture)
return;
}
llassert(mTexture[ch].notNull());
new_texture->addTextureStats(mTexture[ch]->getMaxVirtualSize()) ;
if (mTexture[ch].notNull())
{
new_texture->addTextureStats(mTexture[ch]->getMaxVirtualSize()) ;
}
if (ch == LLRender::DIFFUSE_MAP)
{
getViewerObject()->changeTEImage(mTEOffset, new_texture) ;
if (getViewerObject())
{
getViewerObject()->changeTEImage(mTEOffset, new_texture) ;
}
}
setTexture(ch, new_texture) ;
......
......@@ -2613,7 +2613,7 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
}
}
if (phys_volume->mHullPoints)
if (phys_volume->mHullPoints && phys_volume->mHullIndices && phys_volume->mNumHullPoints > 0 && phys_volume->mNumHullIndices > 0)
{
//render hull
......@@ -2703,8 +2703,8 @@ void renderPhysicsShape(LLDrawable* drawable, LLVOVolume* volume)
if (phys_volume->mHullPoints && phys_volume->mHullIndices)
{
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
gGL.diffuseColor4fv(line_color.mV);
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
LLVertexBuffer::drawElements(LLRender::TRIANGLES, phys_volume->mNumHullPoints, phys_volume->mHullPoints, NULL, phys_volume->mNumHullIndices, phys_volume->mHullIndices);
gGL.diffuseColor4fv(color.mV);
......
......@@ -2155,6 +2155,8 @@ void LLPipeline::updateMoveNormalAsync(LLDrawable* drawablep)
void LLPipeline::updateMovedList(LLDrawable::drawable_vector_t& moved_list)
{
LLDrawable::drawable_vector_t newList; // removing elements in the middle of a vector is a really bad idea. I'll just create a new one and swap it at the end.
for (LLDrawable::drawable_vector_t::iterator iter = moved_list.begin();
iter != moved_list.end(); )
{
......@@ -2183,9 +2185,14 @@ void LLPipeline::updateMovedList(LLDrawable::drawable_vector_t& moved_list)
drawablep->getVObj()->dirtySpatialGroup(TRUE);
}
}
iter = moved_list.erase(curiter);
}
else
{
newList.push_back( drawablep );
}
}
moved_list.swap( newList );
}
static LLTrace::BlockTimerStatHandle FTM_OCTREE_BALANCE("Balance Octree");
......@@ -3053,7 +3060,7 @@ void LLPipeline::rebuildPriorityGroups()
group->clearState(LLSpatialGroup::IN_BUILD_Q1);
}
mGroupSaveQ1.swap(mGroupQ1);
mGroupSaveQ1 = std::move(mGroupQ1);
mGroupQ1.clear();
mGroupQ1Locked = false;
......@@ -3091,7 +3098,7 @@ void LLPipeline::rebuildGroups()
{
group->rebuildGeom();
if (group->getSpatialPartition()->mRenderByGroup)
if (group->getSpatialPartition() && group->getSpatialPartition()->mRenderByGroup)
{
count++;
}
......@@ -3491,7 +3498,7 @@ void LLPipeline::markRebuild(LLDrawable *drawablep, LLDrawable::EDrawableFlags f
mBuildQ2.push_back(drawablep);
drawablep->setState(LLDrawable::IN_REBUILD_Q2); // need flag here because it is just a list
}
if (flag & (LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION))
if ((flag & (LLDrawable::REBUILD_VOLUME | LLDrawable::REBUILD_POSITION)) && drawablep->getVObj().notNull())
{
drawablep->getVObj()->setChanged(LLXform::SILHOUETTE);
}
......
......@@ -759,7 +759,7 @@ class LLPipeline
LLSpatialGroup::sg_vector_t mMeshDirtyGroup; //groups that need rebuildMesh called
U32 mMeshDirtyQueryObject;
LLDrawable::drawable_list_t mPartitionQ; //drawables that need to update their spatial partition radius
LLDrawable::drawable_vector_t mPartitionQ; //drawables that need to update their spatial partition radius
bool mGroupQ2Locked;
bool mGroupQ1Locked;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment