From 55dbc78c1dbc77defffbc016b202661b19e257ce Mon Sep 17 00:00:00 2001 From: "Zeeshan Ali (Khattak)" Date: Wed, 24 Jun 2009 14:43:10 +0300 Subject: [PATCH] tracker: Clamp the index and offset Without this, Rygel was crashing because of tracker plugin passing invalid params to List.slice(). --- src/plugins/tracker/rygel-tracker-root-container.vala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/tracker/rygel-tracker-root-container.vala b/src/plugins/tracker/rygel-tracker-root-container.vala index a008449..7f65f9f 100644 --- a/src/plugins/tracker/rygel-tracker-root-container.vala +++ b/src/plugins/tracker/rygel-tracker-root-container.vala @@ -59,10 +59,11 @@ public class Rygel.TrackerRootContainer : MediaContainer { uint max_count, Cancellable? cancellable, AsyncReadyCallback callback) { - uint stop = offset + max_count; - + uint start = offset.clamp (0, this.child_count - 1); + uint stop = start + max_count; stop = stop.clamp (0, this.child_count); - var children = this.categories.slice ((int) offset, (int) stop); + + var children = this.categories.slice ((int) start, (int) stop); var res = new Rygel.SimpleAsyncResult> ( this, -- 2.7.4