From f6def73465c162beb08a033cac8287bc49484d1d Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 23 Apr 2009 21:42:23 +0000 Subject: Hey, FBasicString throws exceptions when you try to use the index operator and the index operator is out of range... --- src/fbasicstring.h | 4 ++++ 1 file changed, 4 insertions(+) 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 */ chr &operator[]( long nIndex ) { + if( nIndex < 0 || nIndex >= nLength ) + throw Bu::ExceptionBase("Index out of range."); flatten(); return pFirst->pData[nIndex]; @@ -1348,6 +1350,8 @@ namespace Bu */ const chr &operator[]( long nIndex ) const { + if( nIndex < 0 || nIndex >= nLength ) + throw Bu::ExceptionBase("Index out of range."); flatten(); return pFirst->pData[nIndex]; -- cgit v1.2.3