issue #2790: Fix for TMXObjectGroup::getObject.

This commit is contained in:
James Chen 2013-12-07 16:38:50 +08:00
parent beb6bb6c8d
commit 908f5ed515
1 changed files with 6 additions and 5 deletions

View File

@ -44,14 +44,15 @@ TMXObjectGroup::~TMXObjectGroup()
ValueMap TMXObjectGroup::getObject(const std::string& objectName) const
{
if (_objects.size() > 0)
if (!_objects.empty())
{
for (auto& v : _objects)
for (const auto& v : _objects)
{
ValueMap dict = v.asValueMap();
if (dict["name"].asString() == objectName)
const ValueMap& dict = v.asValueMap();
if (dict.find("name") != dict.end())
{
return dict;
if (dict.at("name").asString() == objectName)
return dict;
}
}
}