Skip to content

Commit

Permalink
Issue #109: Fixed exception thrown when connecting to second (and sub…
Browse files Browse the repository at this point in the history
…sequent) endpoints in MIKMIDIInputPort.
  • Loading branch information
Andrew Madsen committed Nov 4, 2015
1 parent f71e399 commit 68467f8
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Source/MIKMIDIInputPort.m
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ - (id)connectToSource:(MIKMIDISourceEndpoint *)source
![self connectToSource:source error:error]) {
return nil;
}

NSString *uuidString = [self createNewConnectionToken];
[self addConnectionToken:uuidString andEventHandler:eventHandler forSource:source];
return uuidString;
Expand Down Expand Up @@ -134,10 +134,12 @@ - (NSString *)createNewConnectionToken
do { // Very unlikely, but just to be safe
uuidString = [[NSUUID UUID] UUIDString];
MIKMIDIConnectionTokenAndEventHandler *existingPair = nil;
for (MIKMIDIConnectionTokenAndEventHandler *pair in self.handlerTokenPairsByEndpoint.objectEnumerator) {
if ([pair.connectionToken isEqualToString:uuidString]) {
existingPair = pair;
break;
for (NSArray *handlerPairs in self.handlerTokenPairsByEndpoint.objectEnumerator) {
for (MIKMIDIConnectionTokenAndEventHandler *pair in handlerPairs) {
if ([pair.connectionToken isEqualToString:uuidString]) {
existingPair = pair;
break;
}
}
}
if (!existingPair) break;
Expand Down

0 comments on commit 68467f8

Please sign in to comment.