From 29dd27c6953bea80686b5ef4b9f189c7724d0298 Mon Sep 17 00:00:00 2001 From: Alexey Alexandrov Date: Mon, 12 Aug 2019 12:17:19 -0700 Subject: [PATCH] Internal change PiperOrigin-RevId: 262978966 --- src/throttler_api.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/throttler_api.cc b/src/throttler_api.cc index 538f40e3b..384b1d0cb 100644 --- a/src/throttler_api.cc +++ b/src/throttler_api.cc @@ -400,7 +400,9 @@ void APIThrottler::ResetClientContext() { void APIThrottler::Close() { std::lock_guard lock(ctx_mutex_); closed_ = true; - ctx_->TryCancel(); + if (ctx_) { + ctx_->TryCancel(); + } } } // namespace profiler