Skip to content

Commit

Permalink
Merge pull request #219 from VladimirTechMan/improve_evidencesource_init
Browse files Browse the repository at this point in the history
Small improvement to EvidenceSource initWithNibNamed:
  • Loading branch information
dustinrue committed Feb 24, 2013
2 parents b16be90 + 0d2bd76 commit 142b3f3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Source/EvidenceSource.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,17 @@ - (id)initWithNibNamed:(NSString *)name
}

// Look for an NSPanel
panel = nil;
NSEnumerator *en = [topLevelObjects objectEnumerator];
NSObject *obj;
while ((obj = [en nextObject])) {
if ([obj isKindOfClass:[NSPanel class]] && !panel)
panel = (NSPanel *) [obj retain];
while ((obj = [en nextObject]) && !([obj isKindOfClass:[NSPanel class]])) {
}
if (!panel) {
if (!obj) {
NSLog(@"%@ >> failed to find an NSPanel in nib named '%@'!", [self class], name);
return nil;
}

panel = (NSPanel *) [obj retain];

// Get notified when we go to sleep, and wake from sleep
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(goingToSleep:)
Expand Down

0 comments on commit 142b3f3

Please sign in to comment.