Skip to content
This repository has been archived by the owner on May 19, 2018. It is now read-only.

Commit

Permalink
Bugfix for initial start. Closes #20
Browse files Browse the repository at this point in the history
  • Loading branch information
Dennis Blöte committed May 4, 2009
1 parent 3ec9691 commit 8aa7316
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions Classes/iOctocatAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,10 @@ - (void)applicationDidFinishLaunching:(UIApplication *)application {
- (GHUser *)currentUser {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *login = [defaults valueForKey:kUsernameDefaultsKey];
return ([login isEqualToString:@""]) ? nil : [self userWithLogin:login];
return (!login || [login isEqualToString:@""]) ? nil : [self userWithLogin:login];
}

- (GHUser *)userWithLogin:(NSString *)theUsername {
if ([theUsername isEqualToString:@""]) return nil;
GHUser *user = [users objectForKey:theUsername];
if (user == nil) {
user = [[[GHUser alloc] initWithLogin:theUsername] autorelease];
Expand All @@ -44,7 +43,7 @@ - (GHUser *)userWithLogin:(NSString *)theUsername {
// Use this to add credentials (for instance via email) by opening a link:
// <githubauth://LOGIN:TOKEN@github.com>
- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url {
if (!url) return NO;
if (!url || [[url user] isEqualToString:@""] || [[url password] isEqualToString:@""]) return NO;
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setValue:[url user] forKey:kUsernameDefaultsKey];
[defaults setValue:[url password] forKey:kTokenDefaultsKey];
Expand Down

0 comments on commit 8aa7316

Please sign in to comment.