mirror of
https://github.com/glest/glest-source.git
synced 2025-02-24 19:52:25 +01:00
- 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;
|
||||
|
||||
// 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 &&
|
||||
(gameHasBeenInitiated == false || (connectionSlot->getSocket() != NULL && socketTriggered == true))) {
|
||||
if(connectionSlot->isConnected() == false || socketTriggered == true) {
|
||||
@ -309,7 +309,12 @@ void ServerInterface::updateSlot(ConnectionSlotEvent *event) {
|
||||
else {
|
||||
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__);
|
||||
|
Loading…
x
Reference in New Issue
Block a user