[runtime stats] Fix crash when RCS are enabled dynamically.

Review-Url: https://codereview.chromium.org/2484963002
Cr-Commit-Position: refs/heads/master@{#40847}
This commit is contained in:
alph 2016-11-08 10:16:33 -08:00 committed by Commit bot
parent ba5885cc8b
commit ddfdd3b8f9

View File

@ -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) {