std::string(NULL,0) asserts in MSVC Debug
authorFrances Buontempo <frances.buontempo@gmail.com>
Tue, 3 Jan 2012 12:06:24 +0000 (12:06 +0000)
committerFrances Buontempo <frances.buontempo@gmail.com>
Tue, 3 Jan 2012 12:06:24 +0000 (12:06 +0000)
src/string_piece.h

index 2f881a2..ad1153e 100644 (file)
@@ -43,7 +43,7 @@ struct StringPiece {
   /// Convert the slice into a full-fledged std::string, copying the
   /// data into a new string.
   string AsString() const {
-    return string(str_, len_);
+    return len_ ? string(str_, len_) : string();
   }
 
   const char* str_;