Commit 15b71141 authored by Ken Rockot's avatar Ken Rockot Committed by Commit Bot

Make InlinedStructPtr get() return null when null

For consistency with StructPtr and general developer expectations around
APIs named get(), this changes InlinedStructPtr to return a nullptr when
its internal state is NIL, rather than always returning a valid pointer.

Bug: None
Change-Id: Ia3e59af0374362b3a1e53b418b728336b99149c4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2461750
Commit-Queue: Ken Rockot <rockot@google.com>
Auto-Submit: Ken Rockot <rockot@google.com>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Cr-Commit-Position: refs/heads/master@{#815801}
parent 6ffcb74a
...@@ -171,7 +171,11 @@ class InlinedStructPtr { ...@@ -171,7 +171,11 @@ class InlinedStructPtr {
DCHECK(state_ == VALID); DCHECK(state_ == VALID);
return &value_; return &value_;
} }
Struct* get() const { return &value_; } Struct* get() const {
if (state_ == NIL)
return nullptr;
return &value_;
}
void Swap(InlinedStructPtr* other) { void Swap(InlinedStructPtr* other) {
std::swap(value_, other->value_); std::swap(value_, other->value_);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment