From 4cdccd2775fae8bb5b9ad4e4b0a8a666387e03a9 Mon Sep 17 00:00:00 2001 From: HaseenaSainul Date: Thu, 18 Jan 2024 04:59:54 -0500 Subject: [PATCH] CoreTest: use has_value() check before accessing optional field --- src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.cpp b/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.cpp index 327dcb413..080b36d54 100644 --- a/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.cpp +++ b/src/sdks/core/src/cpp/sdk/cpptest/CoreSDKTest.cpp @@ -388,12 +388,13 @@ void PrintClosedCaptionsSettings( const Firebolt::Accessibility::ClosedCaptionsS if (closedCaptionsSettings.styles.windowOpacity.has_value()) { cout << "ClosedCaptionsSettings::Styles::WindowOpacity : " << closedCaptionsSettings.styles.windowOpacity.value() << endl; } - cout << "ClosedCaptionsSettings::PreferredLanguages :"; - - for (auto index: closedCaptionsSettings.preferredLanguages.value()) { - cout << " " << index; + if (closedCaptionsSettings.preferredLanguages.has_value()) { + cout << "ClosedCaptionsSettings::PreferredLanguages :"; + for (auto index: closedCaptionsSettings.preferredLanguages.value()) { + cout << " " << index; + } + cout << endl; } - cout << endl; } void CoreSDKTest::GetAccessibilityClosedCaptionsSettings() {