make |Last| not try to adjust an iterator into an empty string (stops illegal calls to |Last| on an empty string from going into an infinite looop), r=mscott
git-svn-id: svn://10.0.0.236/trunk@77752 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -571,7 +571,12 @@ basic_nsAReadableString<CharT>::Last() const
|
||||
{
|
||||
NS_ASSERTION(Length()>0, "|Last()| on an empty string");
|
||||
|
||||
return *(EndReading()-=1);
|
||||
// nsReadingIterator<CharT> iter; EndReading(iter);
|
||||
nsReadingIterator<CharT> iter( EndReading() );
|
||||
if ( !IsEmpty() )
|
||||
iter -= 1;
|
||||
|
||||
return *iter; // Note: this has undefined results if |IsEmpty()|
|
||||
}
|
||||
|
||||
template <class CharT>
|
||||
|
||||
Reference in New Issue
Block a user