adium 3730:17d1c79d8099: The substring fail when reading a bad log.

commits at adium.im commits at adium.im
Fri Mar 11 17:33:03 UTC 2011


details:	http://hg.adium.im/adium/rev/17d1c79d8099
revision:	3730:17d1c79d8099
branch:		(none)
author:		Thijs Alkemade <thijsalkemade at gmail.com>
date:		Fri Mar 11 18:32:39 2011 +0100

The substring fail when reading a bad log.

I know this just fixes a symptom, but it's better than raising an exception.

diffs (18 lines):

diff -r ba0eaace6cb0 -r 17d1c79d8099 Plugins/Purple Service/ESPurpleJabberAccount.m
--- a/Plugins/Purple Service/ESPurpleJabberAccount.m	Fri Mar 11 14:22:56 2011 +0100
+++ b/Plugins/Purple Service/ESPurpleJabberAccount.m	Fri Mar 11 18:32:39 2011 +0100
@@ -615,7 +615,13 @@
 - (NSString *)fallbackAliasForContact:(AIListContact *)contact inChat:(AIChat *)chat
 {
 	if (contact.isStranger && [contact.UID.lowercaseString rangeOfString:chat.name.lowercaseString].location != NSNotFound) {
-		return [contact.UID substringFromIndex:[contact.UID rangeOfString:@"/"].location + 1];		
+		NSInteger loc = [contact.UID rangeOfString:@"/"].location;
+		
+		if (loc == NSNotFound) {
+			return [super fallbackAliasForContact:contact inChat:chat];
+		}
+		
+		return [contact.UID substringFromIndex:loc + 1];		
 	} else {
 		return [super fallbackAliasForContact:contact inChat:chat];
 	}




More information about the commits mailing list