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)
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)
DEFAULT_SEARCH_ENGINE,
CURRENT_HOME_PAGE,
URL_BAR_HEIGHT,
- BOTTOM_BAR_HEIGHT
+ BOTTOM_BAR_HEIGHT,
+ CONFIG_ERROR = -1
};
#endif /* CONFIGKEY_H_ */
{
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(
{
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)
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(),
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 */