Permalink
Browse files

fix const version of CVariant::operator[]

  • Loading branch information...
1 parent 5d57233 commit 43c12938971bae980a3a20f005cff5ee7f6ef55f @Montellese Montellese committed Oct 5, 2011
Showing with 3 additions and 2 deletions.
  1. +3 −2 xbmc/utils/Variant.cpp
View
@@ -299,8 +299,9 @@ CVariant &CVariant::operator[](const std::string &key)
const CVariant &CVariant::operator[](const std::string &key) const
{
- if (m_type == VariantTypeObject && isMember(key))
- return m_map.at(key);
+ VariantMap::const_iterator it;
+ if (m_type == VariantTypeObject && (it = m_map.find(key)) != m_map.end())
+ return it->second;
else
return ConstNullVariant;
}

0 comments on commit 43c1293

Please sign in to comment.