aboutsummaryrefslogtreecommitdiff
path: root/src/fbasicstring.h
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-04-23 21:42:23 +0000
committerMike Buland <eichlan@xagasoft.com>2009-04-23 21:42:23 +0000
commitf6def73465c162beb08a033cac8287bc49484d1d (patch)
tree792b927474b6a981c53dfeef71bd460741eae36b /src/fbasicstring.h
parent3e2568caa2f79f3302a9ecb0a762f9c5c4b7a521 (diff)
downloadlibbu++-f6def73465c162beb08a033cac8287bc49484d1d.tar.gz
libbu++-f6def73465c162beb08a033cac8287bc49484d1d.tar.bz2
libbu++-f6def73465c162beb08a033cac8287bc49484d1d.tar.xz
libbu++-f6def73465c162beb08a033cac8287bc49484d1d.zip
Hey, FBasicString throws exceptions when you try to use the index operator and
the index operator is out of range...
Diffstat (limited to 'src/fbasicstring.h')
-rw-r--r--src/fbasicstring.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/fbasicstring.h b/src/fbasicstring.h
index 57e798e..6a1708d 100644
--- a/src/fbasicstring.h
+++ b/src/fbasicstring.h
@@ -1336,6 +1336,8 @@ namespace Bu
1336 */ 1336 */
1337 chr &operator[]( long nIndex ) 1337 chr &operator[]( long nIndex )
1338 { 1338 {
1339 if( nIndex < 0 || nIndex >= nLength )
1340 throw Bu::ExceptionBase("Index out of range.");
1339 flatten(); 1341 flatten();
1340 1342
1341 return pFirst->pData[nIndex]; 1343 return pFirst->pData[nIndex];
@@ -1348,6 +1350,8 @@ namespace Bu
1348 */ 1350 */
1349 const chr &operator[]( long nIndex ) const 1351 const chr &operator[]( long nIndex ) const
1350 { 1352 {
1353 if( nIndex < 0 || nIndex >= nLength )
1354 throw Bu::ExceptionBase("Index out of range.");
1351 flatten(); 1355 flatten();
1352 1356
1353 return pFirst->pData[nIndex]; 1357 return pFirst->pData[nIndex];