[baobab] Be robust if the recent list is shorter than MAX



commit 81ad2c54268264ebbb04347a597e2b80833a2abd
Author: Paolo Borelli <pborelli gnome org>
Date:   Sat Oct 6 14:07:03 2012 +0200

    Be robust if the recent list is shorter than MAX

 src/baobab-location-list.vala |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/baobab-location-list.vala b/src/baobab-location-list.vala
index 109f423..1cc0e1e 100644
--- a/src/baobab-location-list.vala
+++ b/src/baobab-location-list.vala
@@ -167,7 +167,11 @@ namespace Baobab {
                 return (int)(b.get_modified () - a.get_modified ());
             });
 
-            recent_items.nth (MAX_RECENT_LOCATIONS - 1).next = null;
+            unowned List<Gtk.RecentInfo> last = recent_items.nth (MAX_RECENT_LOCATIONS - 1);
+            if (last != null) {
+                last.next = null;
+            }
+
             recent_items.reverse ();
 
             foreach (var info in recent_items) {



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