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 <natim@webrtc.org>
Reviewed-by: Jonas Oreland <jonaso@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#33197}
diff --git a/p2p/base/ice_controller_interface.h b/p2p/base/ice_controller_interface.h
index d5dc29e7..0e77d1d 100644
--- a/p2p/base/ice_controller_interface.h
+++ b/p2p/base/ice_controller_interface.h
@@ -87,7 +87,9 @@
// 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<const Connection*>(conn)
+ : absl::nullopt),
+ recheck_delay_ms(_recheck_delay_ms) {}
// Connection that we should (optionally) ping.
const absl::optional<const Connection*> connection;