[vlc-devel] [PATCH] qt: fix missing return value in ChapterModel

Abel Tesfaye abeltesfaye45 at gmail.com
Fri Jun 14 17:26:47 CEST 2019


From: Abel Tesfaye <Abeltesfaye45 at gmail.com>

---
 modules/gui/qt/util/input_models.cpp | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/modules/gui/qt/util/input_models.cpp b/modules/gui/qt/util/input_models.cpp
index 918f93193d..6b0a0b8bf1 100644
--- a/modules/gui/qt/util/input_models.cpp
+++ b/modules/gui/qt/util/input_models.cpp
@@ -346,24 +346,25 @@ void ChapterListModel::resetTitle(const vlc_player_title *newTitle)
 
 QString ChapterListModel::getNameAtPosition(float pos) const
 {
-    if(m_title == nullptr)
-        return qtr("nothing found");
+    if(m_title != nullptr){
 
-    vlc_tick_t posTime = pos * m_title->length;
-    int prevChapterIndex = 0;
+        vlc_tick_t posTime = pos * m_title->length;
+        int prevChapterIndex = 0;
 
-    for(unsigned int i=0;i<m_title->chapter_count;i++){
+        for(unsigned int i=0;i<m_title->chapter_count;i++){
 
-        vlc_tick_t currentChapterTime = m_title->chapters[i].time;
+            vlc_tick_t currentChapterTime = m_title->chapters[i].time;
 
-        if(currentChapterTime > posTime)
-           return qfu(m_title->chapters[prevChapterIndex].name);
+            if(currentChapterTime > posTime)
+                return qfu(m_title->chapters[prevChapterIndex].name);
 
-        else if(i == (m_title->chapter_count - 1))
-            return qfu(m_title->chapters[i].name);
+            else if(i == (m_title->chapter_count - 1))
+                return qfu(m_title->chapters[i].name);
 
-        prevChapterIndex = i;
+            prevChapterIndex = i;
+        }
     }
+    return QString();
 }
 
 //***************************
-- 
2.21.0



More information about the vlc-devel mailing list