Skip to content
This repository has been archived by the owner on Mar 3, 2022. It is now read-only.

Commit

Permalink
Make sure we always return something!
Browse files Browse the repository at this point in the history
  • Loading branch information
CDrummond committed Apr 26, 2018
1 parent 4bc7174 commit 2932240
Showing 1 changed file with 8 additions and 13 deletions.
21 changes: 8 additions & 13 deletions models/playqueuemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ static QString fileUrl(const QString &file, bool useServer, bool useLocal)
return QString();
}

static QString checkUrl(const QString &url, const QDir &dir, bool useServer, bool useLocal, const QSet<QString> &handlers)
static QString checkUrl(const QString &url, const QDir &dir, bool useServer, bool useLocal, const QSet<QString> &handlers)
{
int pos = url.indexOf(QLatin1String("://"));
QString handler = pos>0 ? url.left(pos+3).toLower() : QString();
Expand All @@ -126,20 +126,15 @@ static QString checkUrl(const QString &url, const QDir &dir, bool useServer, bo
return StreamsModel::constPrefix+url;
} else if (handlers.contains(handler)) {
return url;
} else {
if (checkExtension(url)) {
QString path = dir.filePath(url);
QString fUrl;
if (QFile::exists(path)) { // Relative
fUrl=fileUrl(path, useServer, useLocal);
} else if (QFile::exists(url)) { // Absolute
fUrl=fileUrl(url, useServer, useLocal);
}
if (!fUrl.isEmpty()) {
return fUrl;
}
} else if (checkExtension(url)) {
QString path = dir.filePath(url);
if (QFile::exists(path)) { // Relative
return fileUrl(path, useServer, useLocal);
} else if (QFile::exists(url)) { // Absolute
return fileUrl(url, useServer, useLocal);
}
}
return QString();
}

static QStringList expandM3uPlaylist(const QString &playlist, bool useServer, bool useLocal, const QSet<QString> &handlers)
Expand Down

0 comments on commit 2932240

Please sign in to comment.