[f-spot] avoid exception on empty db



commit e7a9c0bf4b9a15f27c10505b02309f44d4094361
Author: Mike Gemünde <mike gemuende de>
Date:   Mon Jul 13 12:46:20 2009 +0200

    avoid exception on empty db

 src/Widgets/FolderTreeModel.cs |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/Widgets/FolderTreeModel.cs b/src/Widgets/FolderTreeModel.cs
index 53f1688..0b1da04 100644
--- a/src/Widgets/FolderTreeModel.cs
+++ b/src/Widgets/FolderTreeModel.cs
@@ -181,12 +181,14 @@ namespace FSpot.Widgets
 				
 			}
 			
-			/* and at least, step back and update photo count */
-			while (IterParent (out iter, iter)) {
-				last_count += (int)GetValue (iter, 1);
-				SetValue (iter, 1, last_count);
+			if (IterIsValid (iter)) {
+				/* and at least, step back and update photo count */
+				while (IterParent (out iter, iter)) {
+					last_count += (int)GetValue (iter, 1);
+					SetValue (iter, 1, last_count);
+				}
+				count_all += (int)last_count;
 			}
-			count_all += (int)last_count;
 		}
 	}
 }



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