Skip to content

Commit

Permalink
src: remove unnecessary else in base_object-inl.h
Browse files Browse the repository at this point in the history
This commit removes two unnecessary else statements in
base_object-inl.h. It also tries to make the if statements consistent
with regards to braces.

PR-URL: #33413
Reviewed-By: Zeyu Yang <[email protected]>
Reviewed-By: Richard Lau <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
  • Loading branch information
danbev authored and codebytere committed Jun 18, 2020
1 parent 64cae13 commit a942f72
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/base_object-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -217,20 +217,22 @@ BaseObject::PointerData*
BaseObjectPtrImpl<T, kIsWeak>::pointer_data() const {
if (kIsWeak) {
return data_.pointer_data;
} else {
if (get_base_object() == nullptr) return nullptr;
return get_base_object()->pointer_data();
}
if (get_base_object() == nullptr) {
return nullptr;
}
return get_base_object()->pointer_data();
}

template <typename T, bool kIsWeak>
BaseObject* BaseObjectPtrImpl<T, kIsWeak>::get_base_object() const {
if (kIsWeak) {
if (pointer_data() == nullptr) return nullptr;
if (pointer_data() == nullptr) {
return nullptr;
}
return pointer_data()->self;
} else {
return data_.target;
}
return data_.target;
}

template <typename T, bool kIsWeak>
Expand Down

0 comments on commit a942f72

Please sign in to comment.