From 741699190a07906edaf9456b3341dc8cbf640551 Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Sat, 31 Jul 2004 11:28:24 +0000 Subject: [PATCH] Fixed a couple of crashes This was SVN commit r851. --- source/gui/GUItext.cpp | 15 ++++++++++----- source/gui/GUItext.h | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/source/gui/GUItext.cpp b/source/gui/GUItext.cpp index cd9be98630..8fab84b3ca 100755 --- a/source/gui/GUItext.cpp +++ b/source/gui/GUItext.cpp @@ -300,7 +300,7 @@ void CGUIString::SetValue(const CStr& str) { // Check for possible value-strings if (Line.GetArgCount() == 2) - Line.GetArgString(1, (std::string &)tag.m_TagValue); + Line.GetArgString(1, tag.m_TagValue); // Finalize last if (curpos != from_nonraw) @@ -478,11 +478,16 @@ void CGUIString::SetValue(const CStr& str) // Remove duplicates vector::iterator it; int last_word = -1; - for (it = m_Words.begin(); it != m_Words.end(); ++it) + for (it = m_Words.begin(); it != m_Words.end(); ) { if (last_word == *it) - m_Words.erase(it); - - last_word = *it; + { + it = m_Words.erase(it); + } + else + { + last_word = *it; + ++it; + } } } diff --git a/source/gui/GUItext.h b/source/gui/GUItext.h index 885aaf25aa..cbcc2519ba 100755 --- a/source/gui/GUItext.h +++ b/source/gui/GUItext.h @@ -199,7 +199,7 @@ public: * In [B=Hello][/B] * m_TagValue is 'Hello' */ - CStr m_TagValue; + std::string m_TagValue; }; /**