diff --git a/indra/newview/llviewermessage.cpp b/indra/newview/llviewermessage.cpp index a5033696f..6659fe835 100644 --- a/indra/newview/llviewermessage.cpp +++ b/indra/newview/llviewermessage.cpp @@ -3939,9 +3939,10 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) is_owned_by_me = chatter->permYouOwner(); } + else is_owned_by_me = owner_id == gAgentID; U32 links_for_chatting_objects = gSavedSettings.getU32("LinksForChattingObjects"); - if (links_for_chatting_objects != 0 && chatter && chat.mSourceType == CHAT_SOURCE_OBJECT && + if (links_for_chatting_objects != 0 /*&& chatter*/ && chat.mSourceType == CHAT_SOURCE_OBJECT && (!is_owned_by_me || links_for_chatting_objects == 2) // [RLVa:KB] && !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWNAMES) @@ -3956,13 +3957,16 @@ void process_chat_from_simulator(LLMessageSystem *msg, void **user_data) if( !gRlvHandler.hasBehaviour(RLV_BHVR_SHOWLOC) ) // [/RLVa:KB] { + // Fallback on the owner, if the chatter isn't present, lastly use the agent's region at the origin. + const LLViewerObject* obj(chatter ? chatter : gObjectList.findObject(owner_id)); // Compute the object SLURL. - LLVector3 pos = chatter->getPositionRegion(); + LLVector3 pos = obj ? obj->getPositionRegion() : LLVector3::zero; S32 x = llround((F32)fmod((F64)pos.mV[VX], (F64)REGION_WIDTH_METERS)); S32 y = llround((F32)fmod((F64)pos.mV[VY], (F64)REGION_WIDTH_METERS)); S32 z = llround((F32)pos.mV[VZ]); std::ostringstream location; - location << chatter->getRegion()->getName() << "/" << x << "/" << y << "/" << z; + location << (obj ? obj->getRegion() : gAgent.getRegion())->getName() << "/" << x << "/" << y << "/" << z; + if (chatter != obj) location << "?owner_not_object"; query_string["slurl"] = location.str(); }