diff options
author | Monroe Linden <monroe@lindenlab.com> | 2010-03-05 18:11:55 -0800 |
---|---|---|
committer | Monroe Linden <monroe@lindenlab.com> | 2010-03-05 18:11:55 -0800 |
commit | eee50d1401ff7dfcb9c9fdc2c6e61e6d6281f5e2 (patch) | |
tree | d3e0adbe278ff4409cc492006c89eb71fa97ff38 /indra/newview/llpopupview.cpp | |
parent | 9412447b4f49e068fc5890821ed4b8686e13d723 (diff) |
Fix for a crash on startup/shutdown introduced in the tip of viewer-2-0 very recently.
list.erase(list.find()) is not safe, because erasing list.end() is undefined. Check to make sure the find succeeded before doing the erase.
Reviewed by Richard at http://codereview.lindenlab.com/341001
Diffstat (limited to 'indra/newview/llpopupview.cpp')
-rw-r--r-- | indra/newview/llpopupview.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/indra/newview/llpopupview.cpp b/indra/newview/llpopupview.cpp index 590a45c96c..1668a91eed 100644 --- a/indra/newview/llpopupview.cpp +++ b/indra/newview/llpopupview.cpp @@ -207,7 +207,11 @@ void LLPopupView::addPopup(LLView* popup) { if (popup) { - mPopups.erase(std::find(mPopups.begin(), mPopups.end(), popup->getHandle())); + popup_list_t::iterator iter = std::find(mPopups.begin(), mPopups.end(), popup->getHandle()); + if(iter != mPopups.end()) + { + mPopups.erase(iter); + } mPopups.push_front(popup->getHandle()); } } @@ -220,7 +224,11 @@ void LLPopupView::removePopup(LLView* popup) { gFocusMgr.setKeyboardFocus(NULL); } - mPopups.erase(std::find(mPopups.begin(), mPopups.end(), popup->getHandle())); + popup_list_t::iterator iter = std::find(mPopups.begin(), mPopups.end(), popup->getHandle()); + if(iter != mPopups.end()) + { + mPopups.erase(iter); + } popup->onTopLost(); } } |