From a97c931cbab5a472bee08490356e6bd53c681920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sami=20Kalliom=C3=A4ki?= Date: Tue, 19 Jun 2018 10:53:57 +0200 Subject: [PATCH] Fix a bug where TestAudioDeviceModule crashes if destroyed uninitialized. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Because thread_ object is created in Init, destructor used to crash when calling thread_->Stop() because it was referencing a null pointer. Bug: webrtc:9404 Change-Id: I1c943d0fa50f9341aaa516b32495bb25bf4d664b Reviewed-on: https://webrtc-review.googlesource.com/84122 Reviewed-by: Stefan Holmer Reviewed-by: Artem Titov Commit-Queue: Sami Kalliomäki Cr-Commit-Position: refs/heads/master@{#23682} --- modules/audio_device/include/test_audio_device.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/modules/audio_device/include/test_audio_device.cc b/modules/audio_device/include/test_audio_device.cc index 9d833b312f..e24afdad08 100644 --- a/modules/audio_device/include/test_audio_device.cc +++ b/modules/audio_device/include/test_audio_device.cc @@ -81,7 +81,9 @@ class TestAudioDeviceModuleImpl ~TestAudioDeviceModuleImpl() { StopPlayout(); StopRecording(); - thread_->Stop(); + if (thread_) { + thread_->Stop(); + } } int32_t Init() {