do some checks on data fetched from last.fm while parsing it
This commit is contained in:
17
src/info.cpp
17
src/info.cpp
@@ -277,8 +277,21 @@ void *Info::PrepareArtist(void *screen_void_ptr)
|
|||||||
urls.push_back(result.substr(i, j-i));
|
urls.push_back(result.substr(i, j-i));
|
||||||
}
|
}
|
||||||
|
|
||||||
a = result.find("<content>")+static_strlen("<content>");
|
bool parse_failed = 0;
|
||||||
b = result.find("</content>");
|
if ((a = result.find("<content>")) != std::string::npos)
|
||||||
|
{
|
||||||
|
a += static_strlen("<content>");
|
||||||
|
if ((b = result.find("</content>")) == std::string::npos)
|
||||||
|
parse_failed = 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
parse_failed = 1;
|
||||||
|
if (parse_failed)
|
||||||
|
{
|
||||||
|
*screen->w << "Error: Fetched data could not be parsed";
|
||||||
|
ArtistReady = 1;
|
||||||
|
pthread_exit(0);
|
||||||
|
}
|
||||||
|
|
||||||
if (a == b)
|
if (a == b)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user