summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/string_piece.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string_piece.h b/src/string_piece.h
index 2f881a2..ad1153e 100644
--- a/src/string_piece.h
+++ b/src/string_piece.h
@@ -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_;