From 5d16d7fd52739e4cffc9e1c3540ccccac3f76f12 Mon Sep 17 00:00:00 2001 From: Qingsi Wang Date: Wed, 13 Jun 2018 16:08:14 -0700 Subject: [PATCH] Add a DCHECK for null port in FakePortAllocator. If the socket server of the thread where FakePortAllocator lives is not configured to be a VirtualSocketServer, there is a chance that we have a null port in FakePortAllocator::StartGettingPort after creating the test UDP port (for example, no permission to create a real socket if using a PhysicalSocketServer), and subsequently this results in a crash when connecting a signal in the port to a slot. Bug: webrtc:9406 Change-Id: I1ba4526f7b9e104bed556f61d9348edc426fc1fc Reviewed-on: https://webrtc-review.googlesource.com/83480 Reviewed-by: Taylor Brandstetter Commit-Queue: Qingsi Wang Cr-Commit-Position: refs/heads/master@{#23606} --- p2p/base/fakeportallocator.h | 1 + 1 file changed, 1 insertion(+) diff --git a/p2p/base/fakeportallocator.h b/p2p/base/fakeportallocator.h index b5db8238e1..514340bd5b 100644 --- a/p2p/base/fakeportallocator.h +++ b/p2p/base/fakeportallocator.h @@ -129,6 +129,7 @@ class FakePortAllocatorSession : public PortAllocatorSession { port_.reset(TestUDPPort::Create(network_thread_, factory_, &network, 0, 0, username(), password(), std::string(), false)); + RTC_DCHECK(port_); port_->SignalDestroyed.connect( this, &FakePortAllocatorSession::OnPortDestroyed); AddPort(port_.get());