From 20834ca806595a4f46c838f1e69c32d0c836fb12 Mon Sep 17 00:00:00 2001 From: ivoc Date: Thu, 4 Feb 2016 06:33:37 -0800 Subject: [PATCH] Adds a nullptr check to prevent a rare crash when starting or stopping an RtcEventLog. BUG=webrtc:4741,chromium:581788 Review URL: https://codereview.webrtc.org/1666843003 Cr-Commit-Position: refs/heads/master@{#11490} --- talk/media/webrtc/webrtcvoiceengine.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/talk/media/webrtc/webrtcvoiceengine.cc b/talk/media/webrtc/webrtcvoiceengine.cc index 46d780e3d9..150042300d 100644 --- a/talk/media/webrtc/webrtcvoiceengine.cc +++ b/talk/media/webrtc/webrtcvoiceengine.cc @@ -1153,12 +1153,22 @@ void WebRtcVoiceEngine::StopAecDump() { bool WebRtcVoiceEngine::StartRtcEventLog(rtc::PlatformFile file) { RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); - return voe_wrapper_->codec()->GetEventLog()->StartLogging(file); + webrtc::RtcEventLog* event_log = voe_wrapper_->codec()->GetEventLog(); + if (event_log) { + return event_log->StartLogging(file); + } + LOG_RTCERR0(StartRtcEventLog); + return false; } void WebRtcVoiceEngine::StopRtcEventLog() { RTC_DCHECK(worker_thread_checker_.CalledOnValidThread()); - voe_wrapper_->codec()->GetEventLog()->StopLogging(); + webrtc::RtcEventLog* event_log = voe_wrapper_->codec()->GetEventLog(); + if (event_log) { + event_log->StopLogging(); + return; + } + LOG_RTCERR0(StopRtcEventLog); } int WebRtcVoiceEngine::CreateVoEChannel() {