[vlc-commits] qt: add bound checking to selected setters in SelectableListModel

Pierre Lamot git at videolan.org
Tue Nov 19 16:50:05 CET 2019


vlc | branch: master | Pierre Lamot <pierre at videolabs.io> | Mon Nov 18 14:50:56 2019 +0100| [181a858dde76400b5b3b0908c753e3469d454f64] | committer: Jean-Baptiste Kempf

qt: add bound checking to selected setters in SelectableListModel

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 modules/gui/qt/components/selectable_list_model.cpp | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/modules/gui/qt/components/selectable_list_model.cpp b/modules/gui/qt/components/selectable_list_model.cpp
index cf6711761d..3371893e9a 100644
--- a/modules/gui/qt/components/selectable_list_model.cpp
+++ b/modules/gui/qt/components/selectable_list_model.cpp
@@ -26,6 +26,8 @@ namespace vlc {
 
 void SelectableListModel::setSelected(int row, bool selected)
 {
+    assert( row >= 0 && row < rowCount() );
+
     setRowSelected(row, selected);
 
     QModelIndex modelIndex = index(row);
@@ -35,11 +37,15 @@ void SelectableListModel::setSelected(int row, bool selected)
 
 bool SelectableListModel::isSelected(int row) const
 {
+    assert( row >= 0 && row < rowCount() );
+
     return isRowSelected(row);
 }
 
 void SelectableListModel::toggleSelected(int row)
 {
+    assert( row >= 0 && row < rowCount() );
+
     setRowSelected(row, !isRowSelected(row));
 
     QModelIndex modelIndex = index(row);



More information about the vlc-commits mailing list