Don't set cursor if treeview has no more a model

This can happen because set_cursor is often called using idle_add so the
treeview could have been destroyed in the meantime.

issue5069
review27491002
This commit is contained in:
Cédric Krier committed 2016-07-11 18:35:42 +02:00
1 parent 8313790c0e
commit 8832aaa6a8
1 file changed
+2 -2
+2 -2
View File
@@ -1151,8 +1151,8 @@ class ViewTree(View):
def set_cursor(self, new=False, reset_view=True):
self.treeview.grab_focus()
if self.screen.current_record:
model = self.treeview.get_model()
model = self.treeview.get_model()
if self.screen.current_record and model:
path = model.on_get_path(self.screen.current_record)
if model.get_flags() & gtk.TREE_MODEL_LIST_ONLY:
path = (path[0],)