void assign(const char *Start, const char *End) {
clear();
- Chunks.insert(0, MakeRopeString(Start, End));
+ if (Start != End)
+ Chunks.insert(0, MakeRopeString(Start, End));
}
void insert(unsigned Offset, const char *Start, const char *End) {
/// allocation instead of doing tons of tiny allocations.
RopePiece RewriteRope::MakeRopeString(const char *Start, const char *End) {
unsigned Len = End-Start;
+ assert(Len && "Zero length RopePiece is invalid!");
// If we have space for this string in the current alloc buffer, use it.
if (AllocOffs+Len <= AllocChunkSize) {