diff options
author | Chris Lattner <sabre@nondot.org> | 2008-04-23 03:21:50 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2008-04-23 03:21:50 +0000 |
commit | c66d0aa934f2afd412f50881a5e959bb8582cf14 (patch) | |
tree | 0c9100179126071fa635eaad54825bd986163f25 /lib/Rewrite/RewriteRope.cpp | |
parent | 688738fcf89b20504369b90995757c051a59f7a2 (diff) |
fix a rewriter crash on zero length files.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50126 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Rewrite/RewriteRope.cpp')
-rw-r--r-- | lib/Rewrite/RewriteRope.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/Rewrite/RewriteRope.cpp b/lib/Rewrite/RewriteRope.cpp index db55aa1cd4..7ee9fcced2 100644 --- a/lib/Rewrite/RewriteRope.cpp +++ b/lib/Rewrite/RewriteRope.cpp @@ -741,6 +741,7 @@ void RopePieceBTree::erase(unsigned Offset, unsigned NumBytes) { /// 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) { |