diff options
-rw-r--r-- | xbmc/Application.cpp | 12 | ||||
-rw-r--r-- | xbmc/utils/URIUtils.cpp | 3 | ||||
-rw-r--r-- | xbmc/video/VideoDatabase.cpp | 2 | ||||
-rw-r--r-- | xbmc/video/VideoDatabase.h | 2 |
4 files changed, 11 insertions, 8 deletions
diff --git a/xbmc/Application.cpp b/xbmc/Application.cpp index cd8c40cda0..20b8d6a3bf 100644 --- a/xbmc/Application.cpp +++ b/xbmc/Application.cpp @@ -3701,7 +3701,8 @@ PlayBackRet CApplication::PlayStack(const CFileItem& item, bool bRestart) { CStackDirectory dir; CFileItemList movieList; - dir.GetDirectory(item.GetURL(), movieList); + if (!dir.GetDirectory(item.GetURL(), movieList) || movieList.IsEmpty()) + return PLAYBACK_FAIL; // first assume values passed to the stack int selectedFile = item.m_lStartPartNumber; @@ -3768,7 +3769,8 @@ PlayBackRet CApplication::PlayStack(const CFileItem& item, bool bRestart) // calculate the total time of the stack CStackDirectory dir; - dir.GetDirectory(item.GetURL(), *m_currentStack); + if (!dir.GetDirectory(item.GetURL(), *m_currentStack) || m_currentStack->IsEmpty()) + return PLAYBACK_FAIL; long totalTime = 0; for (int i = 0; i < m_currentStack->Size(); i++) { @@ -3794,17 +3796,17 @@ PlayBackRet CApplication::PlayStack(const CFileItem& item, bool bRestart) { // have our times now, so update the dB if (dbs.Open()) { - if( !haveTimes ) + if (!haveTimes && !times.empty()) dbs.SetStackTimes(item.GetPath(), times); - if( item.m_lStartOffset == STARTOFFSET_RESUME ) + if (item.m_lStartOffset == STARTOFFSET_RESUME) { // can only resume seek here, not dvdstate CBookmark bookmark; std::string path = item.GetPath(); if (item.HasProperty("original_listitem_url") && URIUtils::IsPlugin(item.GetProperty("original_listitem_url").asString())) path = item.GetProperty("original_listitem_url").asString(); - if( dbs.GetResumeBookMark(path, bookmark) ) + if (dbs.GetResumeBookMark(path, bookmark)) seconds = bookmark.timeInSeconds; else seconds = 0.0f; diff --git a/xbmc/utils/URIUtils.cpp b/xbmc/utils/URIUtils.cpp index 2699a9d145..d2ad24617d 100644 --- a/xbmc/utils/URIUtils.cpp +++ b/xbmc/utils/URIUtils.cpp @@ -308,7 +308,8 @@ bool URIUtils::GetParentPath(const std::string& strPath, std::string& strParent) { CStackDirectory dir; CFileItemList items; - dir.GetDirectory(url, items); + if (!dir.GetDirectory(url, items)) + return false; items[0]->m_strDVDLabel = GetDirectory(items[0]->GetPath()); if (IsProtocol(items[0]->m_strDVDLabel, "rar") || IsProtocol(items[0]->m_strDVDLabel, "zip")) GetParentPath(items[0]->m_strDVDLabel, strParent); diff --git a/xbmc/video/VideoDatabase.cpp b/xbmc/video/VideoDatabase.cpp index f90056f3ea..3bb3aafa58 100644 --- a/xbmc/video/VideoDatabase.cpp +++ b/xbmc/video/VideoDatabase.cpp @@ -3979,7 +3979,7 @@ bool CVideoDatabase::GetStackTimes(const std::string &filePath, vector<int> &tim } /// \brief Sets the stack times for a particular video file -void CVideoDatabase::SetStackTimes(const std::string& filePath, vector<int> ×) +void CVideoDatabase::SetStackTimes(const std::string& filePath, const vector<int> ×) { try { diff --git a/xbmc/video/VideoDatabase.h b/xbmc/video/VideoDatabase.h index 109a8d6110..b2da0095cd 100644 --- a/xbmc/video/VideoDatabase.h +++ b/xbmc/video/VideoDatabase.h @@ -515,7 +515,7 @@ public: void EraseVideoSettings(const std::string &path = ""); bool GetStackTimes(const std::string &filePath, std::vector<int> ×); - void SetStackTimes(const std::string &filePath, std::vector<int> ×); + void SetStackTimes(const std::string &filePath, const std::vector<int> ×); void GetBookMarksForFile(const std::string& strFilenameAndPath, VECBOOKMARKS& bookmarks, CBookmark::EType type = CBookmark::STANDARD, bool bAppend=false, long partNumber=0); void AddBookMarkToFile(const std::string& strFilenameAndPath, const CBookmark &bookmark, CBookmark::EType type = CBookmark::STANDARD); |