summaryrefslogtreecommitdiff
path: root/absl/status/status.cc
diff options
context:
space:
mode:
Diffstat (limited to 'absl/status/status.cc')
-rw-r--r--absl/status/status.cc8
1 files changed, 8 insertions, 0 deletions
diff --git a/absl/status/status.cc b/absl/status/status.cc
index bbc1895e..df3b740f 100644
--- a/absl/status/status.cc
+++ b/absl/status/status.cc
@@ -147,7 +147,15 @@ void Status::SetPayload(absl::string_view type_url, absl::Cord payload) {
bool Status::ErasePayload(absl::string_view type_url) {
int index = status_internal::FindPayloadIndexByUrl(GetPayloads(), type_url);
if (index != -1) {
+ PrepareToModify();
GetPayloads()->erase(GetPayloads()->begin() + index);
+ if (GetPayloads()->empty() && message().empty()) {
+ // Special case: If this can be represented inlined, it MUST be
+ // inlined (EqualsSlow depends on this behavior).
+ StatusCode c = static_cast<StatusCode>(raw_code());
+ Unref(rep_);
+ rep_ = CodeToInlinedRep(c);
+ }
return true;
}