Commit 8093f31a authored by A. Wilcox's avatar A. Wilcox

Etsy: Ensure MainImage isn't empty before using it.

parent 8edc942a
......@@ -347,8 +347,12 @@ void EtsyItem::updateWithJSON(JSONNode json)
if(listing_json->find("MainImage") != listing_json->end())
{
if(listing_json->at("MainImage").find("url_570xN") != listing_json->at("MainImage").end())
set_without_leaking(this->_picture, strdup(listing_json->at("MainImage").at("url_570xN").as_string().c_str()));
JSONNode mainImage = listing_json->at("MainImage");
if(!mainImage.empty())
{
if(mainImage.find("url_570xN") != mainImage.end())
set_without_leaking(this->_picture, strdup(mainImage.at("url_570xN").as_string().c_str()));
}
}
for(unsigned int i = 0; i < _pictures.size(); i++)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment