Skip to content

Commit

Permalink
Merge pull request #129 from ClayApps/Potential-zero-packet-length-error
Browse files Browse the repository at this point in the history
Potential zero packet length error
  • Loading branch information
armadsen committed Feb 17, 2016
2 parents 2eaced6 + 5f867b2 commit c4a9f63
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
7 changes: 4 additions & 3 deletions Source/MIKMIDIClientDestinationEndpoint.m
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,10 @@ void MIKMIDIDestinationReadProc(const MIDIPacketList *pktList, void *readProcRef
NSMutableArray *receivedCommands = [NSMutableArray array];
MIDIPacket *packet = (MIDIPacket *)pktList->packet;
for (int i=0; i<pktList->numPackets; i++) {
if (packet->length == 0) continue;
NSArray *commands = [MIKMIDICommand commandsWithMIDIPacket:packet];
if (commands) [receivedCommands addObjectsFromArray:commands];
if (packet->length > 0) {
NSArray *commands = [MIKMIDICommand commandsWithMIDIPacket:packet];
if (commands) [receivedCommands addObjectsFromArray:commands];
}
packet = MIDIPacketNext(packet);
}

Expand Down
7 changes: 4 additions & 3 deletions Source/MIKMIDIInputPort.m
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,10 @@ void MIKMIDIPortReadCallback(const MIDIPacketList *pktList, void *readProcRefCon
NSMutableArray *receivedCommands = [NSMutableArray array];
MIDIPacket *packet = (MIDIPacket *)pktList->packet;
for (int i=0; i<pktList->numPackets; i++) {
if (packet->length == 0) continue;
NSArray *commands = [MIKMIDICommand commandsWithMIDIPacket:packet];
if (commands) [receivedCommands addObjectsFromArray:commands];
if (packet->length > 0) {
NSArray *commands = [MIKMIDICommand commandsWithMIDIPacket:packet];
if (commands) [receivedCommands addObjectsFromArray:commands];
}
packet = MIDIPacketNext(packet);
}

Expand Down

0 comments on commit c4a9f63

Please sign in to comment.