[vlc-commits] qt: accept -1 index in isSelected() in SelectableListModel

Fatih Uzunoglu git at videolan.org
Tue Jan 12 13:20:50 UTC 2021


vlc | branch: master | Fatih Uzunoglu <fuzun54 at outlook.com> | Fri Jan  8 00:36:52 2021 +0300| [40c19d93eee56d5fadfad04909d15895e8eea69f] | committer: Pierre Lamot

qt: accept -1 index in isSelected() in SelectableListModel

this allows to remove explicit '-1' checks in the frontend

Signed-off-by: Pierre Lamot <pierre at videolabs.io>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=40c19d93eee56d5fadfad04909d15895e8eea69f
---

 modules/gui/qt/util/selectable_list_model.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/modules/gui/qt/util/selectable_list_model.cpp b/modules/gui/qt/util/selectable_list_model.cpp
index 3371893e9a..232ddfda14 100644
--- a/modules/gui/qt/util/selectable_list_model.cpp
+++ b/modules/gui/qt/util/selectable_list_model.cpp
@@ -37,7 +37,10 @@ void SelectableListModel::setSelected(int row, bool selected)
 
 bool SelectableListModel::isSelected(int row) const
 {
-    assert( row >= 0 && row < rowCount() );
+    assert( row >= -1 && row < rowCount() );
+
+    if ( row == -1 )
+        return false;
 
     return isRowSelected(row);
 }



More information about the vlc-commits mailing list