diff --git a/db/dbformat.h b/db/dbformat.h index 013028a76d..f990040511 100644 --- a/db/dbformat.h +++ b/db/dbformat.h @@ -139,7 +139,11 @@ class InternalKey { AppendInternalKey(&rep_, ParsedInternalKey(user_key, s, t)); } - void DecodeFrom(const Slice& s) { rep_.assign(s.data(), s.size()); } + bool DecodeFrom(const Slice& s) { + rep_.assign(s.data(), s.size()); + return !rep_.empty(); + } + Slice Encode() const { assert(!rep_.empty()); return rep_; diff --git a/db/version_edit.cc b/db/version_edit.cc index 2385e7dfd1..cd770ef12d 100644 --- a/db/version_edit.cc +++ b/db/version_edit.cc @@ -86,8 +86,7 @@ void VersionEdit::EncodeTo(std::string* dst) const { static bool GetInternalKey(Slice* input, InternalKey* dst) { Slice str; if (GetLengthPrefixedSlice(input, &str)) { - dst->DecodeFrom(str); - return true; + return dst->DecodeFrom(str); } else { return false; }