From 664f8178ac6fb627497d9f4a2becea4b63a47ec5 Mon Sep 17 00:00:00 2001 From: chanayane Date: Thu, 30 Jan 2025 00:08:03 +0100 Subject: [PATCH] fix crash when double-clicking animation in a different state than active state --- indra/newview/ao.cpp | 6 ++++++ indra/newview/aoengine.cpp | 4 ++++ indra/newview/aoengine.h | 1 + 3 files changed, 11 insertions(+) diff --git a/indra/newview/ao.cpp b/indra/newview/ao.cpp index 930c33dfef..f0fb99875f 100644 --- a/indra/newview/ao.cpp +++ b/indra/newview/ao.cpp @@ -798,6 +798,12 @@ void FloaterAO::onDoubleClick() return; } + // do nothing if animation is for a different state than the active state + if (mSelectedState != AOEngine::instance().getCurrentState()) + { + return; + } + // activate AO set if necessary if (AOEngine::instance().getCurrentSet() != mSelectedSet) { diff --git a/indra/newview/aoengine.cpp b/indra/newview/aoengine.cpp index f30383d483..33f91d556a 100644 --- a/indra/newview/aoengine.cpp +++ b/indra/newview/aoengine.cpp @@ -1063,6 +1063,10 @@ const AOSet* AOEngine::getCurrentSet() const { return mCurrentSet; } +const AOSet::AOState* AOEngine::getCurrentState() const +{ + return mCurrentSet->getStateByRemapID(mLastMotion); +} // void AOEngine::updateSortOrder(AOSet::AOState* state) diff --git a/indra/newview/aoengine.h b/indra/newview/aoengine.h index 184cb6c25d..438fe217b9 100644 --- a/indra/newview/aoengine.h +++ b/indra/newview/aoengine.h @@ -126,6 +126,7 @@ class AOEngine // Double click on animation in AO void playAnimation(const LLUUID& animation); const AOSet* getCurrentSet() const; + const AOSet::AOState* getCurrentState() const; // void inMouselook(bool mouselook);