diff options
-rw-r--r-- | src/fstring.h | 9 |
1 files changed, 9 insertions, 0 deletions
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 | |||
117 | { | 117 | { |
118 | long nLen; | 118 | long nLen; |
119 | for( nLen = 0; pData[nLen] != (chr)0; nLen++ ); | 119 | for( nLen = 0; pData[nLen] != (chr)0; nLen++ ); |
120 | if( nLen == 0 ) | ||
121 | return; | ||
120 | 122 | ||
121 | Chunk *pNew = newChunk( nLen ); | 123 | Chunk *pNew = newChunk( nLen ); |
122 | cpy( pNew->pData, pData, nLen ); | 124 | cpy( pNew->pData, pData, nLen ); |
@@ -126,6 +128,9 @@ namespace Bu | |||
126 | 128 | ||
127 | void append( const chr *pData, long nLen ) | 129 | void append( const chr *pData, long nLen ) |
128 | { | 130 | { |
131 | if( nLen == 0 ) | ||
132 | return; | ||
133 | |||
129 | Chunk *pNew = newChunk( nLen ); | 134 | Chunk *pNew = newChunk( nLen ); |
130 | 135 | ||
131 | cpy( pNew->pData, pData, nLen ); | 136 | cpy( pNew->pData, pData, nLen ); |
@@ -235,6 +240,8 @@ namespace Bu | |||
235 | 240 | ||
236 | MyType &operator +=( const MyType &rSrc ) | 241 | MyType &operator +=( const MyType &rSrc ) |
237 | { | 242 | { |
243 | if( rSrc.nLength == 0 ) | ||
244 | return (*this); | ||
238 | rSrc.flatten(); | 245 | rSrc.flatten(); |
239 | append( rSrc.pFirst->pData, rSrc.nLength ); | 246 | append( rSrc.pFirst->pData, rSrc.nLength ); |
240 | 247 | ||
@@ -612,6 +619,8 @@ namespace Bu | |||
612 | { | 619 | { |
613 | if( isShared() == false ) | 620 | if( isShared() == false ) |
614 | return; | 621 | return; |
622 | if( pFirst == NULL ) | ||
623 | return; | ||
615 | 624 | ||
616 | Chunk *pNew = newChunk( nLength ); | 625 | Chunk *pNew = newChunk( nLength ); |
617 | chr *pos = pNew->pData; | 626 | chr *pos = pNew->pData; |