summaryrefslogtreecommitdiff
path: root/indra/newview/llviewerobject.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llviewerobject.cpp')
-rw-r--r--indra/newview/llviewerobject.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/indra/newview/llviewerobject.cpp b/indra/newview/llviewerobject.cpp
index 7be7d6f97f..72fd3c1a4a 100644
--- a/indra/newview/llviewerobject.cpp
+++ b/indra/newview/llviewerobject.cpp
@@ -879,6 +879,13 @@ U32 LLViewerObject::processUpdateMessage(LLMessageSystem *mesgsys,
LLMemType mt(LLMemType::MTYPE_OBJECT);
U32 retval = 0x0;
+ // If region is removed from the list it is also deleted.
+ if (!LLWorld::instance().isRegionListed(mRegionp))
+ {
+ llwarns << "Updating object in an invalid region" << llendl;
+ return retval;
+ }
+
// Coordinates of objects on simulators are region-local.
U64 region_handle;
mesgsys->getU64Fast(_PREHASH_RegionData, _PREHASH_RegionHandle, region_handle);
@@ -2384,10 +2391,11 @@ void LLViewerObject::interpolateLinearMotion(const F64 & time, const F32 & dt)
{ // This will put the object underground, but we can't tell if it will stop
// at ground level or not
min_height = LLWorld::getInstance()->getMinAllowedZ(this, new_pos_global);
+ // Cap maximum height
+ new_pos.mV[VZ] = llmin(LLWorld::getInstance()->getRegionMaxHeight(), new_pos.mV[VZ]);
}
new_pos.mV[VZ] = llmax(min_height, new_pos.mV[VZ]);
- new_pos.mV[VZ] = llmin(LLWorld::getInstance()->getRegionMaxHeight(), new_pos.mV[VZ]);
// Check to see if it's going off the region
LLVector3 temp(new_pos);
@@ -3512,7 +3520,8 @@ LLNameValue *LLViewerObject::getNVPair(const std::string& name) const
void LLViewerObject::updatePositionCaches() const
{
- if(mRegionp)
+ // If region is removed from the list it is also deleted.
+ if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
{
if (!isRoot())
{
@@ -3529,7 +3538,8 @@ void LLViewerObject::updatePositionCaches() const
const LLVector3d LLViewerObject::getPositionGlobal() const
{
- if(mRegionp)
+ // If region is removed from the list it is also deleted.
+ if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
{
LLVector3d position_global = mRegionp->getPosGlobalFromRegion(getPositionRegion());
@@ -3548,7 +3558,8 @@ const LLVector3d LLViewerObject::getPositionGlobal() const
const LLVector3 &LLViewerObject::getPositionAgent() const
{
- if (mRegionp)
+ // If region is removed from the list it is also deleted.
+ if(mRegionp && LLWorld::instance().isRegionListed(mRegionp))
{
if (mDrawable.notNull() && (!mDrawable->isRoot() && getParent()))
{