File tree Expand file tree Collapse file tree 2 files changed +10
-2
lines changed
Expand file tree Collapse file tree 2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change 1010
1111# Other
1212.DS_store
13+ .idea
1314
1415# local build scripts
1516build.sh
Original file line number Diff line number Diff line change @@ -3654,14 +3654,16 @@ extern "C" {
36543654 * @retval < 0 on failure
36553655 */
36563656 int enet_peer_send (ENetPeer * peer , enet_uint8 channelID , ENetPacket * packet ) {
3657- ENetChannel * channel = & peer -> channels [ channelID ] ;
3657+ ENetChannel * channel = NULL ;
36583658 ENetProtocol command ;
36593659 size_t fragmentLength ;
36603660
36613661 if (peer -> state != ENET_PEER_STATE_CONNECTED || channelID >= peer -> channelCount || packet -> dataLength > peer -> host -> maximumPacketSize ) {
36623662 return -1 ;
36633663 }
36643664
3665+ channel = & peer -> channels [channelID ];
3666+
36653667 fragmentLength = peer -> mtu - sizeof (ENetProtocolHeader ) - sizeof (ENetProtocolSendFragment );
36663668 if (peer -> host -> checksum != NULL ) {
36673669 fragmentLength -= sizeof (enet_uint32 );
@@ -4141,7 +4143,12 @@ extern "C" {
41414143 }
41424144
41434145 void enet_peer_setup_outgoing_command (ENetPeer * peer , ENetOutgoingCommand * outgoingCommand ) {
4144- ENetChannel * channel = & peer -> channels [outgoingCommand -> command .header .channelID ];
4146+ ENetChannel * channel = NULL ;
4147+
4148+ if (outgoingCommand -> command .header .channelID < peer -> channelCount ) {
4149+ channel = & peer -> channels [outgoingCommand -> command .header .channelID ];
4150+ }
4151+
41454152 peer -> outgoingDataTotal += enet_protocol_command_size (outgoingCommand -> command .header .command ) + outgoingCommand -> fragmentLength ;
41464153
41474154 if (outgoingCommand -> command .header .channelID == 0xFF ) {
You can’t perform that action at this time.
0 commit comments