From c4921bb9de4e1f0c85b64e0c127f1c54dd9083ab Mon Sep 17 00:00:00 2001 From: Andreas Linde Date: Tue, 26 Mar 2013 15:07:27 +0100 Subject: [PATCH] Make sure not to check for store updates if NSLocaleCountryCode returns nil And also make sure it doesn't crash in that case :) --- Classes/BITStoreUpdateManager.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/Classes/BITStoreUpdateManager.m b/Classes/BITStoreUpdateManager.m index afaddef2a6..f694fed702 100644 --- a/Classes/BITStoreUpdateManager.m +++ b/Classes/BITStoreUpdateManager.m @@ -293,9 +293,16 @@ if (self.countryCode) { country = [NSString stringWithFormat:@"&country=%@", self.countryCode]; } else { - country = [NSString stringWithFormat:@"&country=%@", [(NSDictionary *)self.currentLocale objectForKey: NSLocaleCountryCode]]; + // if the local is by any chance the systemLocale, it could happen that the NSLocaleCountryCode returns nil! + if ([(NSDictionary *)self.currentLocale objectForKey:NSLocaleCountryCode]) { + country = [NSString stringWithFormat:@"&country=%@", [(NSDictionary *)self.currentLocale objectForKey:NSLocaleCountryCode]]; + } else { + // don't check, just to be save + BITHockeyLog(@"ERROR: Locale returned nil, can't determine the language!"); + self.checkInProgress = NO; + return; + } } - // TODO: problem with worldwide is timed releases! NSString *appBundleIdentifier = [self.mainBundle objectForInfoDictionaryKey:@"CFBundleIdentifier"];