Index: src/counters.cc |
diff --git a/src/counters.cc b/src/counters.cc |
index d8061f5f3341a2917480713596c6c536f1e8d77e..6e7c1cb90c740ca7ebc5ef45c63a5db267ecbabc 100644 |
--- a/src/counters.cc |
+++ b/src/counters.cc |
@@ -309,9 +309,10 @@ void RuntimeCallStats::Leave(RuntimeCallStats* stats, RuntimeCallTimer* timer) { |
// static |
void RuntimeCallStats::CorrectCurrentCounterId(RuntimeCallStats* stats, |
CounterId counter_id) { |
- DCHECK_NOT_NULL(stats->current_timer_.Value()); |
- RuntimeCallCounter* counter = &(stats->*counter_id); |
- stats->current_timer_.Value()->counter_ = counter; |
+ RuntimeCallTimer* timer = stats->current_timer_.Value(); |
+ // When RCS are enabled dynamically there might be no current timer set up. |
+ if (timer == nullptr) return; |
+ timer->counter_ = &(stats->*counter_id); |
} |
void RuntimeCallStats::Print(std::ostream& os) { |