OTHER: fix some possible segfaults

This commit is contained in:
Thomas Frauendorfer 2009-10-25 00:37:50 +02:00
parent c37eb2950d
commit a3586011a8

View file

@ -234,6 +234,8 @@ XCollection::playlistAddUrl (QString url, QString plsname)
bool bool
XCollection::playlistAddUrl (QUrl url, QString plsname) XCollection::playlistAddUrl (QUrl url, QString plsname)
{ {
if (!m_client->isConnected ()) return false;
//TODO: more tests if file is valid //TODO: more tests if file is valid
if (!url.isValid ()) { if (!url.isValid ()) {
return false; return false;
@ -252,6 +254,8 @@ XCollection::playlistAddUrl (QUrl url, QString plsname)
bool bool
XCollection::playlistClear (QString name) XCollection::playlistClear (QString name)
{ {
if (!m_client->isConnected ()) return false;
if (name == "") { if (name == "") {
name = d->m_activePlaylist; name = d->m_activePlaylist;
} }
@ -263,6 +267,8 @@ XCollection::playlistClear (QString name)
bool bool
XCollection::addPlsFile (QUrl url) XCollection::addPlsFile (QUrl url)
{ {
if (!m_client->isConnected ()) return false;
if (url.scheme ().isEmpty ()) { if (url.scheme ().isEmpty ()) {
//the protocol identifier is missing //the protocol identifier is missing
//we guess we might be local, so just add file:// //we guess we might be local, so just add file://