From 358f7463b90207324d6565759b07499789fb5f68 Mon Sep 17 00:00:00 2001 From: "Peter.VanderBeken%pandora.be" Date: Fri, 29 Sep 2000 12:19:15 +0000 Subject: [PATCH] Fix for bug #53323, provided by jjs@acis.com.au. r=me. Not part of default build. a=leaf. git-svn-id: svn://10.0.0.236/trunk@80142 18797224-902f-48f8-a5cc-f745e15eee43 --- .../transformiix/source/base/MozillaString.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mozilla/extensions/transformiix/source/base/MozillaString.cpp b/mozilla/extensions/transformiix/source/base/MozillaString.cpp index 1fbefc94077..042f7f56d20 100644 --- a/mozilla/extensions/transformiix/source/base/MozillaString.cpp +++ b/mozilla/extensions/transformiix/source/base/MozillaString.cpp @@ -26,6 +26,7 @@ // // Modification History: // Who When What +// JS 20/09/2000 Modified charAt() to return -1 if outof range. Matches TxString // TK 01/13/2000 Added a means to retrieve the nsString object. This // provides an efficient way to retreive nsString data from // Mozilla functions expecting nsString references as @@ -444,11 +445,15 @@ void String::deleteChars(Int32 offset, Int32 count) ptrNSString->Cut(offset, count); } -//Retreive the character stored at "index" (starting from 0) +//Retrieve the character stored at "index" (starting from 0) +//If the index is out of bounds, -1 will be returned. //( PRUnichar nsString::CharAt(PRUint32) ) UNICODE_CHAR String::charAt(Int32 index) const { - return ptrNSString->CharAt(index); + if ((index < length()) && (index >= 0)) + return ptrNSString->CharAt(index); + else + return (UNICODE_CHAR)-1; } //