Skip to content

Commit

Permalink
Compare explicitly against nullptr.
Browse files Browse the repository at this point in the history
Follow-up to 6f0fbad.

PiperOrigin-RevId: 729438488
  • Loading branch information
tomokinat authored and hiroyuki-komatsu committed Feb 21, 2025
1 parent 09d9351 commit ce468cf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/base/singleton.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ template <class Interface, class Impl>
class SingletonMockable {
public:
static Interface *Get() {
if (Interface *mock = mock_.load(std::memory_order_acquire)) {
if (Interface *mock = mock_.load(std::memory_order_acquire);
mock != nullptr) {
return mock;
}
static absl::NoDestructor<Impl> impl;
Expand Down

0 comments on commit ce468cf

Please sign in to comment.