From b50d130ca47bfbaf57783097d2aafa6a1208b2f8 Mon Sep 17 00:00:00 2001 From: Janusz Sobczak Date: Tue, 29 Aug 2023 13:53:16 -0700 Subject: [PATCH] Initialize BooleanMediumSelector Prevents using uninitalized, random, values. PiperOrigin-RevId: 561128853 --- connections/medium_selector.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/connections/medium_selector.h b/connections/medium_selector.h index 92673732..11c9dc34 100644 --- a/connections/medium_selector.h +++ b/connections/medium_selector.h @@ -15,6 +15,7 @@ #define CORE_MEDIUM_SELECTOR_H_ #include + #include "proto/connections_enums.pb.h" namespace nearby { @@ -23,12 +24,12 @@ namespace connections { using Medium = ::location::nearby::proto::connections::Medium; struct BooleanMediumSelector { - bool bluetooth; - bool ble; - bool web_rtc; - bool wifi_lan; - bool wifi_hotspot; - bool wifi_direct; + bool bluetooth = false; + bool ble = false; + bool web_rtc = false; + bool wifi_lan = false; + bool wifi_hotspot = false; + bool wifi_direct = false; constexpr bool Any(bool value) const { return bluetooth == value || ble == value || web_rtc == value ||