[geocoder] Fix for review

This commit is contained in:
Anatoly Serdtcev 2018-12-27 15:29:02 +03:00 committed by mpimenov
parent 3a6e1f02bf
commit 86d7c1f50a

View file

@ -68,20 +68,24 @@ bool Hierarchy::Entry::DeserializeFromJSONImpl(json_t * const root, string const
MYTHROW(base::Json::Exception, ("Not a json object."));
}
json_t * const properties = base::GetJSONObligatoryField(root, "properties");
json_t * const address = base::GetJSONObligatoryField(properties, "address");
json_t * properties = nullptr;
FromJSONObject(root, "properties", properties);
json_t * address = nullptr;
FromJSONObject(properties, "address", address);
bool hasDuplicateAddress = false;
for (size_t i = 0; i < static_cast<size_t>(Type::Count); ++i)
{
Type const type = static_cast<Type>(i);
string const & levelKey = ToString(type);
auto * levelJson = base::GetJSONOptionalField(address, levelKey);
json_t * levelJson = nullptr;
FromJSONObjectOptionalField(address, levelKey, levelJson);
if (!levelJson)
continue;
if (json_is_null(levelJson))
return false;
if (base::JSONIsNull(levelJson))
return false;
string levelValue;
FromJSON(levelJson, levelValue);