aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/PacketPool.cs
diff options
context:
space:
mode:
authorJeff Ames2009-03-03 17:39:57 +0000
committerJeff Ames2009-03-03 17:39:57 +0000
commitd81bc4b5f2819e998030156a0dafc24da1f596b8 (patch)
treef25b1e34a44de792ca951bf37393fd92c374d460 /OpenSim/Framework/PacketPool.cs
parentUpdate svn properties. (diff)
downloadopensim-SC_OLD-d81bc4b5f2819e998030156a0dafc24da1f596b8.zip
opensim-SC_OLD-d81bc4b5f2819e998030156a0dafc24da1f596b8.tar.gz
opensim-SC_OLD-d81bc4b5f2819e998030156a0dafc24da1f596b8.tar.bz2
opensim-SC_OLD-d81bc4b5f2819e998030156a0dafc24da1f596b8.tar.xz
Avoid NRE if client sends unrecognized packet type.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/PacketPool.cs9
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
28using System; 28using System;
29using System.Collections.Generic; 29using System.Collections.Generic;
30using System.Reflection;
30using OpenMetaverse; 31using OpenMetaverse;
31using OpenMetaverse.Packets; 32using OpenMetaverse.Packets;
33using log4net;
32 34
33namespace OpenSim.Framework 35namespace 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