Skip to content

Commit

Permalink
Add nullptr check in getThriftClient()
Browse files Browse the repository at this point in the history
Summary: As above

Differential Revision: D49848576

fbshipit-source-id: d7815487f2f6082effa4b0c34d47122d79e827fe
  • Loading branch information
Stuart Clark authored and facebook-github-bot committed Oct 3, 2023
1 parent ba507ba commit b4cb02e
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class ThriftTransport<hellogoodbye::HelloGoodbyeRouterInfo> : public ThriftTrans
apache::thrift::Client<hellogoodbye::thrift::HelloGoodbye>* getThriftClient() {
if (FOLLY_UNLIKELY(!thriftClient_)) {
thriftClient_ = createThriftClient<apache::thrift::Client<hellogoodbye::thrift::HelloGoodbye>>();
if (flushList_) {
if (thriftClient_.has_value() && flushList_) {
auto* channel = static_cast<apache::thrift::RocketClientChannel*>(
thriftClient_->getChannel());
channel->setFlushList(flushList_);
Expand Down
2 changes: 1 addition & 1 deletion mcrouter/lib/carbon/test/gen/AThriftTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class ThriftTransport<carbon::test::A::ARouterInfo> : public ThriftTransportMeth
apache::thrift::Client<carbon::test::A::thrift::A>* getThriftClient() {
if (FOLLY_UNLIKELY(!thriftClient_)) {
thriftClient_ = createThriftClient<apache::thrift::Client<carbon::test::A::thrift::A>>();
if (flushList_) {
if (thriftClient_.has_value() && flushList_) {
auto* channel = static_cast<apache::thrift::RocketClientChannel*>(
thriftClient_->getChannel());
channel->setFlushList(flushList_);
Expand Down
2 changes: 1 addition & 1 deletion mcrouter/lib/carbon/test/gen/BThriftTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class ThriftTransport<carbon::test::B::BRouterInfo> : public ThriftTransportMeth
apache::thrift::Client<carbon::test::B::thrift::B>* getThriftClient() {
if (FOLLY_UNLIKELY(!thriftClient_)) {
thriftClient_ = createThriftClient<apache::thrift::Client<carbon::test::B::thrift::B>>();
if (flushList_) {
if (thriftClient_.has_value() && flushList_) {
auto* channel = static_cast<apache::thrift::RocketClientChannel*>(
thriftClient_->getChannel());
channel->setFlushList(flushList_);
Expand Down
2 changes: 1 addition & 1 deletion mcrouter/lib/carbon/test/gen/CarbonTestThriftTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ class ThriftTransport<carbon::test::CarbonTestRouterInfo> : public ThriftTranspo
apache::thrift::Client<carbon::test::thrift::CarbonTest>* getThriftClient() {
if (FOLLY_UNLIKELY(!thriftClient_)) {
thriftClient_ = createThriftClient<apache::thrift::Client<carbon::test::thrift::CarbonTest>>();
if (flushList_) {
if (thriftClient_.has_value() && flushList_) {
auto* channel = static_cast<apache::thrift::RocketClientChannel*>(
thriftClient_->getChannel());
channel->setFlushList(flushList_);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ class ThriftTransport<carbon::test::CarbonThriftTestRouterInfo> : public ThriftT
apache::thrift::Client<carbon::test::thrift::CarbonThriftTest>* getThriftClient() {
if (FOLLY_UNLIKELY(!thriftClient_)) {
thriftClient_ = createThriftClient<apache::thrift::Client<carbon::test::thrift::CarbonThriftTest>>();
if (flushList_) {
if (thriftClient_.has_value() && flushList_) {
auto* channel = static_cast<apache::thrift::RocketClientChannel*>(
thriftClient_->getChannel());
channel->setFlushList(flushList_);
Expand Down
2 changes: 1 addition & 1 deletion mcrouter/lib/network/gen/MemcacheThriftTransport.h
Original file line number Diff line number Diff line change
Expand Up @@ -1166,7 +1166,7 @@ class ThriftTransport<MemcacheRouterInfo> : public ThriftTransportMethods<Memcac
apache::thrift::Client<facebook::memcache::thrift::Memcache>* getThriftClient() {
if (FOLLY_UNLIKELY(!thriftClient_)) {
thriftClient_ = createThriftClient<apache::thrift::Client<facebook::memcache::thrift::Memcache>>();
if (flushList_) {
if (thriftClient_.has_value() && flushList_) {
auto* channel = static_cast<apache::thrift::RocketClientChannel*>(
thriftClient_->getChannel());
channel->setFlushList(flushList_);
Expand Down

0 comments on commit b4cb02e

Please sign in to comment.