Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Unified Diff: src/counters.cc

Issue 2505813002: [runtime stats] Fix crash after r41001 (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/counters.cc
diff --git a/src/counters.cc b/src/counters.cc
index ae9ebb79f205f74b3599cf80612ab12e52ad8b1e..5089eb22e8ba397dc7108af37071dd2a74915cde 100644
--- a/src/counters.cc
+++ b/src/counters.cc
@@ -313,7 +313,7 @@ const RuntimeCallStats::CounterId RuntimeCallStats::counters[] = {
void RuntimeCallStats::Enter(RuntimeCallStats* stats, RuntimeCallTimer* timer,
CounterId counter_id) {
RuntimeCallCounter* counter = &(stats->*counter_id);
- DCHECK(counter->name != NULL);
+ DCHECK(counter->name != nullptr);
timer->Start(counter, stats->current_timer_.Value());
stats->current_timer_.SetValue(timer);
}
@@ -327,7 +327,8 @@ void RuntimeCallStats::Leave(RuntimeCallStats* stats, RuntimeCallTimer* timer) {
// buried one that's leaving. We don't care about keeping nested timings
// accurate, just avoid crashing by keeping the chain intact.
RuntimeCallTimer* next = stats->current_timer_.Value();
- while (next->parent() != timer) next = next->parent();
+ while (next && next->parent() != timer) next = next->parent();
+ if (next == nullptr) return;
next->parent_.SetValue(timer->Stop());
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698