From ddfdd3b8f9757905f88458cf92e75ff8110014d1 Mon Sep 17 00:00:00 2001 From: alph Date: Tue, 8 Nov 2016 10:16:33 -0800 Subject: [PATCH] [runtime stats] Fix crash when RCS are enabled dynamically. Review-Url: https://codereview.chromium.org/2484963002 Cr-Commit-Position: refs/heads/master@{#40847} --- src/counters.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/counters.cc b/src/counters.cc index d8061f5f33..6e7c1cb90c 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) {