diff options
author | Mike Buland <eichlan@xagasoft.com> | 2009-04-23 21:42:23 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2009-04-23 21:42:23 +0000 |
commit | f6def73465c162beb08a033cac8287bc49484d1d (patch) | |
tree | 792b927474b6a981c53dfeef71bd460741eae36b /src | |
parent | 3e2568caa2f79f3302a9ecb0a762f9c5c4b7a521 (diff) | |
download | libbu++-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')
-rw-r--r-- | src/fbasicstring.h | 4 |
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]; |