[gnome-music] songsview: Fix a crash in selection mode



commit 441607b316612d5d56546c8bf6f60093e9e8bdc0
Author: Hugo Posnic <hugo posnic gmail com>
Date:   Thu Aug 22 00:58:09 2019 +0200

    songsview: Fix a crash in selection mode
    
    When clicking and dragging a row outside of the TreeView widget in
    selection mode a None path would be returned. This return value was
    unhandled and crashed Music.
    
    Handle the None value and return as it is not a valid row.

 gnomemusic/views/songsview.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/gnomemusic/views/songsview.py b/gnomemusic/views/songsview.py
index a940824c..c56c4dc2 100644
--- a/gnomemusic/views/songsview.py
+++ b/gnomemusic/views/songsview.py
@@ -197,8 +197,11 @@ class SongsView(BaseView):
         # FIXME: In selection mode, star clicks might still trigger
         # activation.
         if self.props.selection_mode:
-            path, col, cell_x, cell_y = self._view.get_path_at_pos(x, y)
-            iter_ = self._view.props.model.get_iter(path)
+            path = self._view.get_path_at_pos(x, y)
+            if path is None:
+                return
+
+            iter_ = self._view.props.model.get_iter(path[0])
             new_fav_status = not self._model[iter_][1]
             self._model[iter_][1] = new_fav_status
             self._model[iter_][7].props.selected = new_fav_status


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]