From b6f50f249ba3b18c597531a2d5dbc45f7bfa3eaa Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 11 Jun 2007 21:58:10 +0000 Subject: Another few fixes for zero-length strings in fstring. --- src/fstring.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src') diff --git a/src/fstring.h b/src/fstring.h index 7dda87c..93a0042 100644 --- a/src/fstring.h +++ b/src/fstring.h @@ -117,6 +117,8 @@ namespace Bu { long nLen; for( nLen = 0; pData[nLen] != (chr)0; nLen++ ); + if( nLen == 0 ) + return; Chunk *pNew = newChunk( nLen ); cpy( pNew->pData, pData, nLen ); @@ -126,6 +128,9 @@ namespace Bu void append( const chr *pData, long nLen ) { + if( nLen == 0 ) + return; + Chunk *pNew = newChunk( nLen ); cpy( pNew->pData, pData, nLen ); @@ -235,6 +240,8 @@ namespace Bu MyType &operator +=( const MyType &rSrc ) { + if( rSrc.nLength == 0 ) + return (*this); rSrc.flatten(); append( rSrc.pFirst->pData, rSrc.nLength ); @@ -612,6 +619,8 @@ namespace Bu { if( isShared() == false ) return; + if( pFirst == NULL ) + return; Chunk *pNew = newChunk( nLength ); chr *pos = pNew->pData; -- cgit v1.2.3