summaryrefslogtreecommitdiff
path: root/absl/status/status.h
diff options
context:
space:
mode:
Diffstat (limited to 'absl/status/status.h')
-rw-r--r--absl/status/status.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/absl/status/status.h b/absl/status/status.h
index 9019e6c2..08d3e806 100644
--- a/absl/status/status.h
+++ b/absl/status/status.h
@@ -705,9 +705,11 @@ inline Status::Status(Status&& x) noexcept : rep_(x.rep_) {
inline Status& Status::operator=(Status&& x) {
uintptr_t old_rep = rep_;
- rep_ = x.rep_;
- x.rep_ = MovedFromRep();
- Unref(old_rep);
+ if (x.rep_ != old_rep) {
+ rep_ = x.rep_;
+ x.rep_ = MovedFromRep();
+ Unref(old_rep);
+ }
return *this;
}