- added a guard for proper slot index usage in network code
This commit is contained in:
parent
45df867490
commit
d07cd76459
|
@ -275,7 +275,7 @@ void ServerInterface::updateSlot(ConnectionSlotEvent *event) {
|
||||||
bool checkForNewClients = true;
|
bool checkForNewClients = true;
|
||||||
|
|
||||||
// Safety check since we can experience a disconnect and the slot is NULL
|
// Safety check since we can experience a disconnect and the slot is NULL
|
||||||
if(slots[event->triggerId] == connectionSlot) {
|
if(event->triggerId >= 0 && slots[event->triggerId] == connectionSlot) {
|
||||||
if(connectionSlot != NULL &&
|
if(connectionSlot != NULL &&
|
||||||
(gameHasBeenInitiated == false || (connectionSlot->getSocket() != NULL && socketTriggered == true))) {
|
(gameHasBeenInitiated == false || (connectionSlot->getSocket() != NULL && socketTriggered == true))) {
|
||||||
if(connectionSlot->isConnected() == false || socketTriggered == true) {
|
if(connectionSlot->isConnected() == false || socketTriggered == true) {
|
||||||
|
@ -309,7 +309,12 @@ void ServerInterface::updateSlot(ConnectionSlotEvent *event) {
|
||||||
else {
|
else {
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
||||||
event->connectionSlot = slots[event->triggerId];
|
if(event->triggerId >= 0) {
|
||||||
|
event->connectionSlot = slots[event->triggerId];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
event->connectionSlot = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user