Don't return a free'd pointer from Echonest::ParseError::what(). Might fix a crash on Windows when there are no echonest results.
(cherry picked from commit 4ec7c0952229df130136a589147a914b68d72abf)
This commit is contained in:
parent
1fc573a3eb
commit
80867af823
44
3rdparty/libechonest/Config.cpp
vendored
44
3rdparty/libechonest/Config.cpp
vendored
@ -45,34 +45,21 @@ QUrl Echonest::baseGetQuery(const QByteArray& type, const QByteArray& method)
|
|||||||
Echonest::ParseError::ParseError(Echonest::ErrorType error): exception()
|
Echonest::ParseError::ParseError(Echonest::ErrorType error): exception()
|
||||||
{
|
{
|
||||||
type = error;
|
type = error;
|
||||||
|
whatData = createWhatData();
|
||||||
}
|
}
|
||||||
|
|
||||||
Echonest::ParseError::ParseError(Echonest::ErrorType error, const QString& text): exception()
|
Echonest::ParseError::ParseError(Echonest::ErrorType error, const QString& text): exception()
|
||||||
{
|
{
|
||||||
type = error;
|
type = error;
|
||||||
extraText = text;
|
extraText = text;
|
||||||
|
whatData = createWhatData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QByteArray Echonest::ParseError::createWhatData() const throw()
|
||||||
Echonest::ParseError::~ParseError() throw()
|
|
||||||
{}
|
|
||||||
|
|
||||||
Echonest::ErrorType Echonest::ParseError::errorType() const throw()
|
|
||||||
{
|
{
|
||||||
return type;
|
// If we have specific error text, use that first
|
||||||
}
|
|
||||||
|
|
||||||
void Echonest::ParseError::setNetworkError( QNetworkReply::NetworkError error ) throw()
|
|
||||||
{
|
|
||||||
nError = error;
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* Echonest::ParseError::what() const throw()
|
|
||||||
{
|
|
||||||
|
|
||||||
// If we have specific error text, return that first
|
|
||||||
if( !extraText.isEmpty() )
|
if( !extraText.isEmpty() )
|
||||||
return extraText.toLatin1().constData();
|
return extraText.toLatin1();
|
||||||
|
|
||||||
switch( type )
|
switch( type )
|
||||||
{
|
{
|
||||||
@ -99,7 +86,26 @@ const char* Echonest::ParseError::what() const throw()
|
|||||||
case UnknownParseError:
|
case UnknownParseError:
|
||||||
return "Unknown Parse Error";
|
return "Unknown Parse Error";
|
||||||
}
|
}
|
||||||
return "";
|
return QByteArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Echonest::ParseError::~ParseError() throw()
|
||||||
|
{}
|
||||||
|
|
||||||
|
Echonest::ErrorType Echonest::ParseError::errorType() const throw()
|
||||||
|
{
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Echonest::ParseError::setNetworkError( QNetworkReply::NetworkError error ) throw()
|
||||||
|
{
|
||||||
|
nError = error;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char* Echonest::ParseError::what() const throw()
|
||||||
|
{
|
||||||
|
return whatData.constData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
3
3rdparty/libechonest/Config.h
vendored
3
3rdparty/libechonest/Config.h
vendored
@ -74,9 +74,12 @@ namespace Echonest{
|
|||||||
|
|
||||||
virtual const char* what() const throw ();
|
virtual const char* what() const throw ();
|
||||||
private:
|
private:
|
||||||
|
QByteArray createWhatData() const throw();
|
||||||
|
|
||||||
ErrorType type;
|
ErrorType type;
|
||||||
QString extraText;
|
QString extraText;
|
||||||
QNetworkReply::NetworkError nError;
|
QNetworkReply::NetworkError nError;
|
||||||
|
QByteArray whatData;
|
||||||
};
|
};
|
||||||
|
|
||||||
class ConfigPrivate;
|
class ConfigPrivate;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user