[meld: 5/12] avoid explicitly returning None



commit 3fe94bb1958a7dc0a303f20a09be7ad3cb3cca9b
Author: hugosenari <hugosenari gmail com>
Date:   Sun Aug 5 04:11:44 2018 -0300

    avoid explicitly returning None

 meld/tree.py        |  2 --
 meld/treehelpers.py | 13 +++++++------
 2 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/meld/tree.py b/meld/tree.py
index 32371645..1a05af53 100644
--- a/meld/tree.py
+++ b/meld/tree.py
@@ -143,8 +143,6 @@ class DiffTreeStore(SearchableTreeStore):
         self.set_state(it, pane, state, display_text, isdir)
 
     def set_state(self, it, pane, state, label, isdir=0):
-        if not it:
-            return None
         col_idx = self.column_index
         icon = self.icon_details[state][1 if isdir else 0]
         tint = self.icon_details[state][3 if isdir else 2]
diff --git a/meld/treehelpers.py b/meld/treehelpers.py
index f6bcfe5b..256e113f 100644
--- a/meld/treehelpers.py
+++ b/meld/treehelpers.py
@@ -154,9 +154,10 @@ class SearchableTreeStore(Gtk.TreeStore):
 
         return None
         """
-        if value is None and hasattr(self, '_none_of_cols'):
-            value = self._none_of_cols.get(column)
-        if value is None:
-            self.set_value(treeiter, column, value)
-        else:
-            _GIGtk.TreeStore.set_value(self, treeiter, column, value)
+        if treeiter:
+            if value is None and hasattr(self, '_none_of_cols'):
+                value = self._none_of_cols.get(column)
+            if value is None:
+                self.set_value(treeiter, column, value)
+            else:
+                _GIGtk.TreeStore.set_value(self, treeiter, column, value)


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