From 84412cc538cfb4fde0d6fa995c957e4d47ccf0bb Mon Sep 17 00:00:00 2001 From: Francis Lachapelle Date: Wed, 5 Oct 2016 15:38:54 -0400 Subject: [PATCH] Improve NSArray comparison in Contacts module --- SoObjects/Contacts/NSArray+Contacts.m | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SoObjects/Contacts/NSArray+Contacts.m b/SoObjects/Contacts/NSArray+Contacts.m index fe4ce974f..0b3512d5d 100644 --- a/SoObjects/Contacts/NSArray+Contacts.m +++ b/SoObjects/Contacts/NSArray+Contacts.m @@ -28,8 +28,8 @@ { id firstObject, otherFirstObject; - firstObject = [self objectAtIndex: 0]; - otherFirstObject = [otherRecord objectAtIndex: 0]; + firstObject = [self count] > 0 ? [self objectAtIndex: 0] : nil; + otherFirstObject = [otherRecord count] > 0 ? [otherRecord objectAtIndex: 0] : nil; return [firstObject compareCaseInsensitiveAscending: otherFirstObject]; }