author | llornkcor <llornkcor> | 2002-06-19 12:34:09 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-06-19 12:34:09 (UTC) |
commit | b55f69a46fd27ce26235029f702c0f3942fde68c (patch) (side-by-side diff) | |
tree | 47aa9ca1e9c80367050a93715f384eef2285e7b9 | |
parent | 1d60bfb5925c5009122ae04009f8e99658436b35 (diff) | |
download | opie-b55f69a46fd27ce26235029f702c0f3942fde68c.zip opie-b55f69a46fd27ce26235029f702c0f3942fde68c.tar.gz opie-b55f69a46fd27ce26235029f702c0f3942fde68c.tar.bz2 |
dont crash on malformed urls
-rw-r--r-- | core/multimedia/opieplayer/playlistwidget.cpp | 35 |
1 files changed, 27 insertions, 8 deletions
diff --git a/core/multimedia/opieplayer/playlistwidget.cpp b/core/multimedia/opieplayer/playlistwidget.cpp index 41fcb30..2323ac2 100644 --- a/core/multimedia/opieplayer/playlistwidget.cpp +++ b/core/multimedia/opieplayer/playlistwidget.cpp @@ -418,2 +418,7 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) { // qDebug("add"); + if( lnk.file().find(" ",0,TRUE) != -1 || lnk.file().find("%20",0,TRUE) != -1) { + QMessageBox::message("Note","You are trying to play\na malformed url."); + + } else { + d->setDocumentUsed = FALSE; @@ -426,2 +431,3 @@ void PlayListWidget::addToSelection( const DocLnk& lnk ) { } +} @@ -848,5 +854,10 @@ void PlayListWidget::btnPlay(bool b) { { + qDebug("here we are"); + if( d->selectedFiles->current()->file().find(" ",0,TRUE) != -1 || d->selectedFiles->current()->file().find("%20",0,TRUE) != -1) { + QMessageBox::message("Note","You are trying to play\na malformed url."); + + } else { mediaPlayerState->setPlaying(b); - } + } } break; @@ -860,4 +871,3 @@ void PlayListWidget::btnPlay(bool b) { insanityBool=FALSE; -// audioView->clearSelection(); - } + }// audioView->clearSelection(); break; @@ -872,6 +882,6 @@ void PlayListWidget::btnPlay(bool b) { insanityBool=FALSE; -// videoView->clearSelection(); - } + }// videoView->clearSelection(); break; }; + } @@ -1070,4 +1080,7 @@ void PlayListWidget::openFile() { // http://66.28.68.70:8000 - filename.replace(QRegExp("%20")," "); - +// filename.replace(QRegExp("%20")," "); + if(filename.find(" ",0,TRUE) != -1 || filename.find("%20",0,TRUE) != -1) { + QMessageBox::message("Note","Spaces in urls are not allowed."); + return; + } else { qDebug("Selected filename is "+filename); @@ -1096,2 +1109,3 @@ void PlayListWidget::openFile() { } + } if(fileDlg) @@ -1207,3 +1221,6 @@ void PlayListWidget::readm3u(const QString &filename) { s=t.readLine(); - if(s.find("#",0,TRUE) == -1) { + if(s.find(" ",0,TRUE) != -1 || s.find("%20",0,TRUE) != -1) { + QMessageBox::message("Note","Spaces in urls are not allowed."); + } + else if(s.find("#",0,TRUE) == -1) { if(s.find(" ",0,TRUE) == -1) { // not sure if this is neede since cf uses vfat @@ -1222,2 +1239,3 @@ void PlayListWidget::readm3u(const QString &filename) { } else { // is url + s.replace(QRegExp("%20")," "); @@ -1240,2 +1258,3 @@ void PlayListWidget::readm3u(const QString &filename) { } + f.close(); } |