[meld] Avoid calling basename on None paths in tree (closes bgo#654847)



commit 11d7d4002305e3b5702e7972202c8e01e63efb86
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Jul 24 13:23:17 2011 +1000

    Avoid calling basename on None paths in tree (closes bgo#654847)
    
    This is defensive code; we shouldn't ever really have empty paths being
    traversed in this update, but filesystems are wacky sometimes.

 meld/dirdiff.py |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/meld/dirdiff.py b/meld/dirdiff.py
index daf22b1..aceac72 100644
--- a/meld/dirdiff.py
+++ b/meld/dirdiff.py
@@ -1069,12 +1069,12 @@ class DirDiff(melddoc.MeldDoc, gnomeglade.Component):
             for component in changed:
                 child = model.iter_children( it )
                 while child:
-                    name = os.path.basename(model.value_path(child, pane))
-                    if component == name : # found it
+                    child_path = model.value_path(child, pane)
+                    # Found the changed path
+                    if child_path and component == os.path.basename(child_path):
                         it = child
                         break
-                    else:
-                        child = self.model.iter_next( child ) # next
+                    child = self.model.iter_next(child)
                 if not it:
                     break
             # save if found and unique



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