PVS_V783 issue fixed. 70/143770/4
authordohyunglim <delight.lim@samsung.com>
Fri, 11 Aug 2017 08:17:49 +0000 (08:17 +0000)
committerHye Kyoung Hwang <cookie@samsung.com>
Fri, 11 Aug 2017 09:28:06 +0000 (09:28 +0000)
Change-Id: I0e61a552f59a4a5719045a00a380d42cb7dd6764
Signed-off-by: dohyunglim <delight.lim@samsung.com>
core/Config/Config.cpp
core/Config/ConfigKey.h
services/TabService/TabService.cpp
services/WebPageUI/WebPageUIStatesManager.cpp

index ea5d966..b7a328a 100755 (executable)
@@ -75,6 +75,7 @@ Config::Config()
 
     m_keysValues[CONFIG_KEY::URL_BAR_HEIGHT] = 108;
     m_keysValues[CONFIG_KEY::BOTTOM_BAR_HEIGHT] = 96;
+    m_keysValues[CONFIG_KEY::CONFIG_ERROR] = -1;
 }
 
 boost::any Config::get(const std::string& key)
@@ -84,7 +85,11 @@ boost::any Config::get(const std::string& key)
 
 const boost::any& Config::get(const CONFIG_KEY& key) const
 {
-    return m_keysValues.find(key)->second;
+    auto it = m_keysValues.find(key);
+    if (it != m_keysValues.end())
+        return m_keysValues.find(key)->second;
+    else
+        return m_keysValues.find(CONFIG_KEY::CONFIG_ERROR)->second;
 }
 
 void Config::set(const std::string & key, const boost::any & value)
index 763832e..1ce131e 100755 (executable)
@@ -39,7 +39,8 @@ enum class CONFIG_KEY
     DEFAULT_SEARCH_ENGINE,
     CURRENT_HOME_PAGE,
     URL_BAR_HEIGHT,
-    BOTTOM_BAR_HEIGHT
+    BOTTOM_BAR_HEIGHT,
+    CONFIG_ERROR = -1
 };
 
 #endif /* CONFIGKEY_H_ */
index 9919f96..efbc412 100755 (executable)
@@ -149,7 +149,16 @@ boost::optional<tools::BrowserImagePtr> TabService::getThumbCache(
 {
     if (!thumbCached(tabId))
         return boost::none;
-    return m_thumbMap.find(tabId.get())->second;
+
+    if (tabId.get()) {
+        auto it = m_thumbMap.find(tabId.get());
+        if (it != m_thumbMap.end())
+            return m_thumbMap.find(tabId.get())->second;
+        else
+            return boost::none;
+    } else {
+        return boost::none;
+    }
 }
 
 boost::optional<tools::BrowserImagePtr> TabService::getFaviconCache(
@@ -157,7 +166,16 @@ boost::optional<tools::BrowserImagePtr> TabService::getFaviconCache(
 {
     if (!faviconCached(tabId))
         return boost::none;
-    return m_faviconMap.find(tabId.get())->second;
+
+    if (tabId.get()) {
+        auto it = m_faviconMap.find(tabId.get());
+        if (it != m_faviconMap.end())
+            return m_faviconMap.find(tabId.get())->second;
+        else
+            return boost::none;
+    } else {
+        return boost::none;
+    }
 }
 
 void TabService::removeTab(const basic_webengine::TabId& tabId)
@@ -283,7 +301,7 @@ void TabService::saveThumbDatabase(
         BROWSER_LOGW("getBlobPNG failed");
         return;
     }
-    auto thumbData = const_cast<unsigned char*>( static_cast<const unsigned char*>(thumb_blob->getData()));
+    auto thumbData = const_cast<unsigned char*>(static_cast<const unsigned char*>(thumb_blob->getData()));
     if (bp_tab_adaptor_set_snapshot(
         tabId.get(),
         imagePtr->getWidth(),
index 0bd2b3a..07d3ce3 100755 (executable)
@@ -50,7 +50,11 @@ bool WebPageUIStatesManager::equals(std::initializer_list<WPUState> states) cons
 
 std::string WebPageUIStatesManager::toString(WPUState state) const
 {
-    return namesMap.find(state)->second;
+    auto it = namesMap.find(state);
+    if (it != namesMap.end())
+        return namesMap.find(state)->second;
+    else
+        return "";
 }
 
 } /* namespace base_ui */