summaryrefslogtreecommitdiff
path: root/indra/newview/llnearbychatbar.cpp
diff options
context:
space:
mode:
authorBrad Payne (Vir Linden) <vir@lindenlab.com>2010-07-28 17:22:03 -0400
committerBrad Payne (Vir Linden) <vir@lindenlab.com>2010-07-28 17:22:03 -0400
commite27170de344a3c4fbeeeb8279f9eb8c7665a9216 (patch)
treea0dfad0fcf5b378c1e2e8bc848111b0540b8817d /indra/newview/llnearbychatbar.cpp
parent76da1229ec26b582e054e8a1588ea78943c92d70 (diff)
EXT-8221 FIX - fixed invalid array index in a vector<LLMultiGesture*>
Diffstat (limited to 'indra/newview/llnearbychatbar.cpp')
-rw-r--r--indra/newview/llnearbychatbar.cpp46
1 files changed, 35 insertions, 11 deletions
diff --git a/indra/newview/llnearbychatbar.cpp b/indra/newview/llnearbychatbar.cpp
index a300e15edd..8a52cf715f 100644
--- a/indra/newview/llnearbychatbar.cpp
+++ b/indra/newview/llnearbychatbar.cpp
@@ -317,9 +317,19 @@ void LLGestureComboList::refreshGestures()
if (gestures)
{
- S32 index = gestures->getSelectedValue().asInteger();
- if(index > 0)
- gesture = mGestures.at(index);
+ S32 sel_index = gestures->getFirstSelectedIndex();
+ if (sel_index != 0)
+ {
+ S32 index = gestures->getSelectedValue().asInteger();
+ if (index<0 || index >= (S32)mGestures.size())
+ {
+ llwarns << "out of range gesture access" << llendl;
+ }
+ else
+ {
+ gesture = mGestures.at(index);
+ }
+ }
}
if(gesture && LLGestureMgr::instance().isGesturePlaying(gesture))
@@ -335,13 +345,13 @@ void LLGestureComboList::onCommitGesture()
LLCtrlListInterface* gestures = getListInterface();
if (gestures)
{
- S32 index = gestures->getFirstSelectedIndex();
- if (index == 0)
+ S32 sel_index = gestures->getFirstSelectedIndex();
+ if (sel_index == 0)
{
return;
}
- index = gestures->getSelectedValue().asInteger();
+ S32 index = gestures->getSelectedValue().asInteger();
if (mViewAllItemIndex == index)
{
@@ -357,13 +367,20 @@ void LLGestureComboList::onCommitGesture()
return;
}
- LLMultiGesture* gesture = mGestures.at(index);
- if(gesture)
+ if (index<0 || index >= (S32)mGestures.size())
+ {
+ llwarns << "out of range gesture index" << llendl;
+ }
+ else
{
- LLGestureMgr::instance().playGesture(gesture);
- if(!gesture->mReplaceText.empty())
+ LLMultiGesture* gesture = mGestures.at(index);
+ if(gesture)
{
- LLNearbyChatBar::sendChatFromViewer(gesture->mReplaceText, CHAT_TYPE_NORMAL, FALSE);
+ LLGestureMgr::instance().playGesture(gesture);
+ if(!gesture->mReplaceText.empty())
+ {
+ LLNearbyChatBar::sendChatFromViewer(gesture->mReplaceText, CHAT_TYPE_NORMAL, FALSE);
+ }
}
}
}
@@ -374,6 +391,13 @@ LLGestureComboList::~LLGestureComboList()
LLGestureMgr::instance().removeObserver(this);
}
+LLCtrlListInterface* LLGestureComboList::getListInterface()
+{
+ LLCtrlListInterface *result = mList;
+ llassert((LLCtrlListInterface*)mList==result);
+ return mList;
+};
+
LLNearbyChatBar::LLNearbyChatBar()
: LLPanel()
, mChatBox(NULL)