[vlc-devel] [PATCH 39/55] qt: accept -1 index in isSelected() in SelectableListModel
    Fatih Uzunoglu 
    fuzun54 at outlook.com
       
    Thu Jan  7 21:36:52 UTC 2021
    
    
  
this allows to remove explicit '-1' checks in the frontend
---
 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);
 }
-- 
2.27.0
    
    
More information about the vlc-devel
mailing list