From 0e86bfee3d1dd0e42fef23293242f52793f08583 Mon Sep 17 00:00:00 2001 From: Robin Cornelius Date: Sat, 9 Oct 2010 10:20:10 +0100 Subject: Fix some STL errors highlighted by MSVC debug --- linden/indra/llrender/llfontregistry.cpp | 2 +- linden/indra/llui/lllineeditor.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/linden/indra/llrender/llfontregistry.cpp b/linden/indra/llrender/llfontregistry.cpp index 2140dbd..9792a91 100644 --- a/linden/indra/llrender/llfontregistry.cpp +++ b/linden/indra/llrender/llfontregistry.cpp @@ -107,7 +107,7 @@ bool removeSubString(std::string& str, const std::string& substr) size_t pos = str.find(substr); if (pos != string::npos) { - str.replace(pos,substr.length(),(const char *)NULL, 0); + str.erase(pos,substr.length()); return true; } return false; diff --git a/linden/indra/llui/lllineeditor.cpp b/linden/indra/llui/lllineeditor.cpp index e73b287..a3785e4 100644 --- a/linden/indra/llui/lllineeditor.cpp +++ b/linden/indra/llui/lllineeditor.cpp @@ -416,7 +416,16 @@ void LLLineEditor::setText(const LLStringExplicit &new_text) setCursor(llmin((S32)mText.length(), getCursor())); // Set current history line to end of history. - mCurrentHistoryLine = mLineHistory.end() - 1; + // RC Fix, its really not safe to just take 1 of the end itterator, if end==begin + // that leaves an invalid state upseting the secure STL checks + if(mLineHistory.empty()) + { + mCurrentHistoryLine = mLineHistory.begin(); + } + else + { + mCurrentHistoryLine = mLineHistory.end() - 1; + } mPrevText = mText; } -- cgit v1.1