Sfoglia il codice sorgente

add test for validity of packet pointer

Oli Larkin 11 anni fa
parent
commit
4e5974b6e3
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      RtMidi.cpp

+ 1 - 1
RtMidi.cpp

@@ -1023,7 +1023,7 @@ void MidiOutCore :: sendMessage( std::vector<unsigned char> *message )
   MIDIPacket *packet = MIDIPacketListInit( packetList );
 
   ByteCount remainingBytes = nBytes;
-  while (remainingBytes) {
+  while (remainingBytes && packet) {
     ByteCount bytesForPacket = remainingBytes > 65535 ? 65535 : remainingBytes; // 65535 = maximum size of a MIDIPacket
     const Byte* dataStartPtr = (const Byte *) &message->at( nBytes - remainingBytes );
     packet = MIDIPacketListAdd( packetList, listSize, packet, timeStamp, bytesForPacket, dataStartPtr);