diff options
author | Jeff Ames | 2009-03-03 17:39:57 +0000 |
---|---|---|
committer | Jeff Ames | 2009-03-03 17:39:57 +0000 |
commit | d81bc4b5f2819e998030156a0dafc24da1f596b8 (patch) | |
tree | f25b1e34a44de792ca951bf37393fd92c374d460 /OpenSim/Framework/PacketPool.cs | |
parent | Update svn properties. (diff) | |
download | opensim-SC-d81bc4b5f2819e998030156a0dafc24da1f596b8.zip opensim-SC-d81bc4b5f2819e998030156a0dafc24da1f596b8.tar.gz opensim-SC-d81bc4b5f2819e998030156a0dafc24da1f596b8.tar.bz2 opensim-SC-d81bc4b5f2819e998030156a0dafc24da1f596b8.tar.xz |
Avoid NRE if client sends unrecognized packet type.
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Framework/PacketPool.cs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/OpenSim/Framework/PacketPool.cs b/OpenSim/Framework/PacketPool.cs index 9994fac..a4f7d96 100644 --- a/OpenSim/Framework/PacketPool.cs +++ b/OpenSim/Framework/PacketPool.cs | |||
@@ -27,13 +27,17 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Collections.Generic; | 29 | using System.Collections.Generic; |
30 | using System.Reflection; | ||
30 | using OpenMetaverse; | 31 | using OpenMetaverse; |
31 | using OpenMetaverse.Packets; | 32 | using OpenMetaverse.Packets; |
33 | using log4net; | ||
32 | 34 | ||
33 | namespace OpenSim.Framework | 35 | namespace OpenSim.Framework |
34 | { | 36 | { |
35 | public sealed class PacketPool | 37 | public sealed class PacketPool |
36 | { | 38 | { |
39 | private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); | ||
40 | |||
37 | private static readonly PacketPool instance = new PacketPool(); | 41 | private static readonly PacketPool instance = new PacketPool(); |
38 | 42 | ||
39 | private bool packetPoolEnabled = false; | 43 | private bool packetPoolEnabled = false; |
@@ -119,7 +123,10 @@ namespace OpenSim.Framework | |||
119 | 123 | ||
120 | int i = 0; | 124 | int i = 0; |
121 | Packet packet = GetPacket(type); | 125 | Packet packet = GetPacket(type); |
122 | packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer); | 126 | if (packet == null) |
127 | m_log.WarnFormat("[PACKETPOOL]: Failed to get packet of type {0}", type); | ||
128 | else | ||
129 | packet.FromBytes(bytes, ref i, ref packetEnd, zeroBuffer); | ||
123 | return packet; | 130 | return packet; |
124 | } | 131 | } |
125 | 132 | ||