From 49ce46f3eab91960d18141b81626540c34e0f757 Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Wed, 13 Jun 2007 20:58:57 +0000 Subject: [PATCH] Monotone-Parent: 20e1476abe6ae755adf53129d9f3cc9837e0382b Monotone-Revision: 5cbb667edb91ebb091b9b4498dcc5745ca8afa1d Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2007-06-13T20:58:57 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++++ UI/Scheduler/NSArray+Scheduler.m | 14 +++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 022ce2c83..4ba411021 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2007-06-13 Wolfgang Sourdeau + * UI/Scheduler/NSArray+Scheduler.m ([NSArray + -compareEventsAscending:otherEvent]): no longer use compare: on + the time objects since one of them could be an NSNull, which + crashes when comparing with anything. + * UI/Scheduler/UIxCalListingActions.m ([UIxCalListingActions -eventsListAction]): sort events from here. ([UIxCalListingActions -tasksListAction]): sort tasks from here. diff --git a/UI/Scheduler/NSArray+Scheduler.m b/UI/Scheduler/NSArray+Scheduler.m index d6d45df11..6425f6c53 100644 --- a/UI/Scheduler/NSArray+Scheduler.m +++ b/UI/Scheduler/NSArray+Scheduler.m @@ -49,7 +49,19 @@ - (NSComparisonResult) compareEventsAscending: (NSArray *) otherEvent { - return [[self objectAtIndex: 4] compare: [otherEvent objectAtIndex: 4]]; + NSComparisonResult result; + unsigned int selfTime, otherTime; + + selfTime = [[self objectAtIndex: 4] intValue]; + otherTime = [[otherEvent objectAtIndex: 4] intValue]; + if (selfTime > otherTime) + result = NSOrderedDescending; + else if (selfTime < otherTime) + result = NSOrderedAscending; + else + result = NSOrderedSame; + + return result; } - (NSComparisonResult) compareTasksAscending: (NSArray *) otherTask