Fix defects detected by static analysis tool 48/298848/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Thu, 14 Sep 2023 05:50:09 +0000 (14:50 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Thu, 14 Sep 2023 05:50:09 +0000 (14:50 +0900)
Change-Id: Idf238fe31b857a47d847a13902e7bdcd5a328df5

src/mmi-manager/mmi-node-prototype.cpp

index d5235fb0b801caf91d5f758026097901ab64d11f..2a6aa316b7c4714883ddb7b00bc30731898c9854 100644 (file)
@@ -126,8 +126,10 @@ mmi_standard_node_type_e NodePrototype::get_type() {
 
 mmi_standard_node_sub_type_e NodePrototype::get_sub_type() {
     mmi_standard_node_sub_type_e ret = std::monostate{};
-    if (m_sub_type.has_value()) {
+    try {
         ret = m_sub_type.value();
+    } catch (const std::bad_optional_access &e) {
+        _E("[std::bad_optional_access] Failed to get node sub_type: %s", e.what());
     }
     return ret;
 }