From 203b549ee21058081c8e44a50c1ed39cc269df72 Mon Sep 17 00:00:00 2001 From: Tim Na Date: Fri, 5 Feb 2021 10:23:53 -0800 Subject: [PATCH] Using nullopt when connection is nullptr. During SelectConnectionToPing, optional connection had the value of nullptr which led the code to crash. Bug: None Change-Id: Ibe9a54b71bbd62f3b80d676ca80d64ff951dda51 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/206081 Commit-Queue: Tim Na Reviewed-by: Jonas Oreland Cr-Commit-Position: refs/heads/master@{#33197} --- p2p/base/ice_controller_interface.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/p2p/base/ice_controller_interface.h b/p2p/base/ice_controller_interface.h index d5dc29e782..0e77d1dd00 100644 --- a/p2p/base/ice_controller_interface.h +++ b/p2p/base/ice_controller_interface.h @@ -87,7 +87,9 @@ class IceControllerInterface { // This represents the result of a call to SelectConnectionToPing. struct PingResult { PingResult(const Connection* conn, int _recheck_delay_ms) - : connection(conn), recheck_delay_ms(_recheck_delay_ms) {} + : connection(conn ? absl::optional(conn) + : absl::nullopt), + recheck_delay_ms(_recheck_delay_ms) {} // Connection that we should (optionally) ping. const absl::optional connection;