[FIRE-36090] Fix crash in handleHover accessing null parent

Merged upstream in SLViewer PR#4986
master
Hecklezz 2025-11-13 01:56:26 +10:00
parent 5fb9e75cd8
commit b3a549b8b5
1 changed files with 22 additions and 18 deletions

View File

@ -1,4 +1,4 @@
/** /**
* @file llmaniptranslate.cpp * @file llmaniptranslate.cpp
* @brief LLManipTranslate class implementation * @brief LLManipTranslate class implementation
* *
@ -716,24 +716,28 @@ bool LLManipTranslate::handleHover(S32 x, S32 y, MASK mask)
// handle attachments in local space // handle attachments in local space
if (object->isAttachment() && object->mDrawable.notNull()) if (object->isAttachment() && object->mDrawable.notNull())
{ {
// calculate local version of relative move LLXform* object_xform_parent = object->mDrawable->mXform.getParent();
LLQuaternion objWorldRotation = object->mDrawable->mXform.getParent()->getWorldRotation(); if (object_xform_parent)
objWorldRotation.transQuat();
LLVector3 old_position_local = object->getPosition();
LLVector3 new_position_local = selectNode->mSavedPositionLocal + (clamped_relative_move_f * objWorldRotation);
//RN: I forget, but we need to do this because of snapping which doesn't often result
// in position changes even when the mouse moves
object->setPosition(new_position_local);
rebuild(object);
gAgentAvatarp->clampAttachmentPositions();
new_position_local = object->getPosition();
if (selectNode->mIndividualSelection)
{ {
// counter-translate child objects if we are moving the root as an individual // calculate local version of relative move
object->resetChildrenPosition(old_position_local - new_position_local, true); LLQuaternion objWorldRotation = object_xform_parent->getWorldRotation();
objWorldRotation.transQuat();
LLVector3 old_position_local = object->getPosition();
LLVector3 new_position_local = selectNode->mSavedPositionLocal + (clamped_relative_move_f * objWorldRotation);
//RN: I forget, but we need to do this because of snapping which doesn't often result
// in position changes even when the mouse moves
object->setPosition(new_position_local);
rebuild(object);
gAgentAvatarp->clampAttachmentPositions();
new_position_local = object->getPosition();
if (selectNode->mIndividualSelection)
{
// counter-translate child objects if we are moving the root as an individual
object->resetChildrenPosition(old_position_local - new_position_local, true);
}
} }
} }
else else