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

Unified Diff: webrtc/base/event_tracer.cc

Issue 2961663002: Trace loggging: Check for g_event_logger is not null before calling it. (Closed)
Patch Set: Formatting. Created 3 years, 6 months 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 | webrtc/sdk/BUILD.gn » ('j') | webrtc/sdk/objc/Framework/UnitTests/RTCPeerConnectionTest.mm » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/event_tracer.cc
diff --git a/webrtc/base/event_tracer.cc b/webrtc/base/event_tracer.cc
index cb7554a891f6db4dd566c6c3c4f4c92333adf652..24ab99acf14b3dba2228073aa78d8e3b408485fa 100644
--- a/webrtc/base/event_tracer.cc
+++ b/webrtc/base/event_tracer.cc
@@ -374,22 +374,30 @@ void SetupInternalTracer() {
}
void StartInternalCaptureToFile(FILE* file) {
- g_event_logger->Start(file, false);
+ if (g_event_logger) {
+ g_event_logger->Start(file, false);
+ }
}
bool StartInternalCapture(const char* filename) {
- FILE* file = fopen(filename, "w");
- if (!file) {
- LOG(LS_ERROR) << "Failed to open trace file '" << filename
- << "' for writing.";
+ if (g_event_logger) {
tommi 2017/07/07 08:53:50 can you turn this around and do: if (!g_event_log
jtt_webrtc 2017/07/07 16:22:40 Done.
+ FILE* file = fopen(filename, "w");
+ if (!file) {
+ LOG(LS_ERROR) << "Failed to open trace file '" << filename
+ << "' for writing.";
+ return false;
+ }
+ g_event_logger->Start(file, true);
+ return true;
+ } else {
return false;
}
- g_event_logger->Start(file, true);
- return true;
}
void StopInternalCapture() {
- g_event_logger->Stop();
+ if (g_event_logger) {
+ g_event_logger->Stop();
+ }
}
void ShutdownInternalTracer() {
« no previous file with comments | « no previous file | webrtc/sdk/BUILD.gn » ('j') | webrtc/sdk/objc/Framework/UnitTests/RTCPeerConnectionTest.mm » ('J')

Powered by Google App Engine
This is Rietveld 408576698