Commit 18ae18aa authored by Scott Wheeler's avatar Scott Wheeler

Don't crash when a user tries to view the back button history and they're

playing one of the first 10 items.

CCMAIL:59441-done@bugs.kde.org

svn path=/trunk/kdemultimedia/juk/; revision=230197
parent 5d417225
...@@ -331,8 +331,8 @@ PlaylistItemList Playlist::historyItems(PlaylistItem *current, bool random) cons ...@@ -331,8 +331,8 @@ PlaylistItemList Playlist::historyItems(PlaylistItem *current, bool random) cons
else if(current) { else if(current) {
current = static_cast<PlaylistItem *>(current->itemAbove()); current = static_cast<PlaylistItem *>(current->itemAbove());
for(int j = 0; current && j < 10; ++j) { for(int j = 0; current && j < 10; ++j) {
current = static_cast<PlaylistItem *>(current->itemAbove());
list.append(current); list.append(current);
current = static_cast<PlaylistItem *>(current->itemAbove());
} }
} }
......
...@@ -139,10 +139,8 @@ void PlaylistSplitter::populatePlayHistoryMenu(QPopupMenu* menu, bool random) ...@@ -139,10 +139,8 @@ void PlaylistSplitter::populatePlayHistoryMenu(QPopupMenu* menu, bool random)
PlaylistItemList list = p->historyItems(m_playingItem, random); PlaylistItemList list = p->historyItems(m_playingItem, random);
menu->clear(); menu->clear();
int i = 0; int i = 0;
for (PlaylistItemList::iterator it = list.begin(); it != list.end(); ++it) for(PlaylistItemList::Iterator it = list.begin(); it != list.end(); ++it)
{
menu->insertItem((*it)->tag()->track(), ++i); menu->insertItem((*it)->tag()->track(), ++i);
}
} }
QString PlaylistSplitter::playSelectedFile() QString PlaylistSplitter::playSelectedFile()
...@@ -532,7 +530,7 @@ void PlaylistSplitter::addImpl(const QString &file, Playlist *list) ...@@ -532,7 +530,7 @@ void PlaylistSplitter::addImpl(const QString &file, Playlist *list)
if(fileInfo.exists()) { if(fileInfo.exists()) {
if(fileInfo.isDir()) { if(fileInfo.isDir()) {
QDir dir(fileInfo.filePath()); QDir dir(fileInfo.filePath());
QStringList dirContents=dir.entryList(); QStringList dirContents = dir.entryList();
for(QStringList::Iterator it = dirContents.begin(); it != dirContents.end(); ++it) for(QStringList::Iterator it = dirContents.begin(); it != dirContents.end(); ++it)
if(*it != "." && *it != "..") if(*it != "." && *it != "..")
addImpl(fileInfo.filePath() + QDir::separator() + *it, list); addImpl(fileInfo.filePath() + QDir::separator() + *it, list);
......
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