summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer3/playlist.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/noncore/multimedia/opieplayer3/playlist.cpp b/noncore/multimedia/opieplayer3/playlist.cpp
index 6f2e668..fe2dde3 100644
--- a/noncore/multimedia/opieplayer3/playlist.cpp
+++ b/noncore/multimedia/opieplayer3/playlist.cpp
@@ -134,65 +134,69 @@ void PlaylistView::addFile(const QString&aFile,const QString&aName)
if (name.isEmpty()) {
name = fileInfo.fileName();
}
int i = m_Infolib->setfile(aFile.utf8().data());
/* realy! otherwise we get an "stopped" signal when playing! - I don't know why */
m_Infolib->stop();
odebug << "File set: " << i << " ("<<aFile.utf8().data()<<")"<<oendl;
if (i<1) {
i = m_Infolib->error();
odebug << "Errorcode: " << i << oendl;
QString msg;
msg = QString(tr("Error open file %1: ")).arg(name);
switch (i) {
case 1:
msg += tr("No input plugin");
break;
case 2:
msg += tr("No demuxer plugin");
break;
case 3:
msg += tr("Demuxer failed");
break;
case 4:
msg+=tr("Malformed mrl");
break;
default:
msg += tr("Unknown error");
break;
}
QMessageBox::warning(0,tr("Error reading fileheader"),msg);
return;
}
- m_lastItem = m_items.last();
+ if (m_items.count()>0) {
+ m_lastItem = m_items.last();
+ } else {
+ m_lastItem = 0;
+ }
PlaylistItem*_it = currentItem();
if (m_lastItem) {
m_lastItem = new PlaylistItem(aFile,this,m_lastItem);
} else {
m_lastItem = new PlaylistItem(aFile,this);
}
m_lastItem->setExpandable(false);
m_lastItem->setText(1,name);
QString codec = m_Infolib->metaInfo(6);
if (codec.isEmpty()) {
codec = m_Infolib->metaInfo(7);
}
// codec
m_lastItem->setText(COL_TYPE,codec);
// title
m_lastItem->setText(COL_TITLE,m_Infolib->metaInfo(0));
// artist
m_lastItem->setText(COL_ARTIST,m_Infolib->metaInfo(2));
// album
m_lastItem->setText(COL_ALBUM,m_Infolib->metaInfo(4));
int l = m_Infolib->length();
int h = l/3600;
l-=h*3600;
int m = l/60;
l-=m*60;
codec = "";
if (h>0) {
codec.sprintf("%2i:%2i:%2i h",h,m,l);
} else {
codec.sprintf("%02i:%02i m",m,l);