From 77f32a9cab6b5697359f7b6631943e8c583eac1a Mon Sep 17 00:00:00 2001 From: Charles Date: Wed, 31 Mar 2010 00:46:21 +0000 Subject: [PATCH] null pointer dereference fix git-svn-id: https://bd85.net/svn/cs3505_group@43 92bb83a3-7c8f-8a45-bc97-515c4e399668 --- .../CS 3505 Project 06/CS 3505 Project 06/NetworkGame.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Project06/CS 3505 Project 06/CS 3505 Project 06/NetworkGame.cs b/Project06/CS 3505 Project 06/CS 3505 Project 06/NetworkGame.cs index 45c5d0a..ae0396b 100644 --- a/Project06/CS 3505 Project 06/CS 3505 Project 06/NetworkGame.cs +++ b/Project06/CS 3505 Project 06/CS 3505 Project 06/NetworkGame.cs @@ -1,5 +1,5 @@  -#undef DEBUG +//#define DEBUG using System; using System.Collections.Generic; @@ -641,8 +641,6 @@ namespace CS_3505_Project_06 NetworkGamer sender; localGamer.ReceiveData(mPacketReader, out sender); - if (sender == null || sender.IsDisposed) continue; - GamerInfo senderInfo = mGamers[sender.Id]; PacketType packetId = (PacketType)mPacketReader.ReadByte(); switch (packetId) @@ -658,6 +656,8 @@ namespace CS_3505_Project_06 case PacketType.Event: + GamerInfo senderInfo = mGamers[sender.Id]; + int stallCount = mPacketReader.ReadInt16(); int averageOwd = mPacketReader.ReadInt16(); int frameNumber = mPacketReader.ReadInt32(); @@ -705,6 +705,8 @@ namespace CS_3505_Project_06 case PacketType.Stall: + GamerInfo senderInfo2 = mGamers[sender.Id]; + byte numStalledPeers = mPacketReader.ReadByte(); byte[] stalledPeers = mPacketReader.ReadBytes(numStalledPeers); -- 2.45.2