LordFenris

Member
Our server crash today with this raport
Exception:
System.NullReferenceException: Object reference not set to an instance of an object
at Server.Mobile.SetLocation (Point3D newLocation, Boolean isTeleport) [0x00000] in <filename unknown>:0
at Server.Mobiles.PlayerMobile.SetLocation (Point3D loc, Boolean isTeleport) [0x00000] in <filename unknown>:0
at Server.Mobile.Move (Direction d) [0x00000] in <filename unknown>:0
at Server.Mobiles.PlayerMobile.Move (Direction d) [0x00000] in <filename unknown>:0
at Server.Network.PacketHandlers.MovementReq (Server.Network.NetState state, Server.Network.PacketReader pvSrc) [0x00000] in <filename unknown>:0
at Server.Network.MessagePump.HandleReceive (Server.Network.NetState ns) [0x00000] in <filename unknown>:0
at Server.Network.MessagePump.Slice () [0x00000] in <filename unknown>:0
at Server.Core.Main (System.String[] args) [0x00000] in <filename unknown>:0

We have never had such an error. Does anyone of you has already had a similar case?
 
Here my Playermobile and PacketHandlers. Perhaps something suspicious return your attention. Error occurs very rarely but unfortunately crashes the server and even though the debug option - does not indicate a specific location code. Ahh on this server all our players use 2D only.
 

Attachments

  • PlayerMobile.cs
    136.4 KB · Views: 0
  • PacketHandlers.cs
    83.4 KB · Views: 0
Hey !

I've had that crash on my server too ... it comes from the core file Mobile.cs.

Here is how I have changed it :

Code:
public virtual void SetLocation(Point3D newLocation, bool isTeleport)
		{
			if (m_Deleted)
			{
				return;
			}
			Point3D oldLocation = m_Location;
			if (oldLocation != newLocation)
			{
				m_Location = newLocation;
				UpdateRegion();
				BankBox box = FindBankNoCreate();
				if (box != null && box.Opened)
				{
					box.Close();
				}
				if (m_NetState != null)
				{
					m_NetState.ValidateAllTrades();
				}
				if (m_Map != null)
				{
					m_Map.OnMove(oldLocation, this);
				}
				if (isTeleport && m_NetState != null && (!m_NetState.HighSeas || !m_NoMoveHS))
				{
					m_NetState.Sequence = 0;
					if (m_NetState.StygianAbyss)
					{
						m_NetState.Send(new MobileUpdate(this));
					}
					else
					{
						m_NetState.Send(new MobileUpdateOld(this));
					}
					ClearFastwalkStack();
				}
				Map map = m_Map;
				if (map != null)
				{
					// First, send a remove message to everyone who can no longer see us. (inOldRange && !inNewRange)
					var eable = map.GetClientsInRange(oldLocation);
					foreach (NetState ns in eable)
					{
						if (ns != m_NetState && !Utility.InUpdateRange(newLocation, ns.Mobile.Location))
						{
							ns.Send(RemovePacket);
						}
					}
					eable.Free();
					NetState ourState = m_NetState;
					// Check to see if we are attached to a client
					if (ourState != null)
					{
						var eeable = map.GetObjectsInRange(newLocation, Core.GlobalMaxUpdateRange);
						// We are attached to a client, so it's a bit more complex. We need to send new items and people to ourself, and ourself to other clients
						foreach (IEntity o in eeable)
						{
							if (o is Item)
							{
								Item item = (Item)o;
								int range = item.GetUpdateRange(this);
								Point3D loc = item.Location;
								if (!Utility.InRange(oldLocation, loc, range) && Utility.InRange(newLocation, loc, range) && CanSee(item))
								{
									item.SendInfoTo(ourState);
								}
							}
							else if (o != this && o is Mobile)
							{
								Mobile m = (Mobile)o;
								if (!Utility.InUpdateRange(newLocation, m.m_Location))
								{
									continue;
								}
								bool inOldRange = Utility.InUpdateRange(oldLocation, m.m_Location);
								if (m != null && m.m_NetState != null && ((isTeleport && (!m.m_NetState.HighSeas || !m_NoMoveHS)) || !inOldRange) &&
									m.CanSee(this))
								{
									m.m_NetState.Send(MobileIncoming.Create(m.m_NetState, m, this));
									if (m != null && m.m_NetState != null && m.m_NetState.StygianAbyss)
									{
										if (m_Poison != null)
										{
											m.m_NetState.Send(new HealthbarPoison(this));
										}
										if (m_Blessed || m_YellowHealthbar)
										{
											m.m_NetState.Send(new HealthbarYellow(this));
										}
									}
									if (m != null && m.m_NetState != null && IsDeadBondedPet)
									{
										m.m_NetState.Send(new BondedStatus(0, m_Serial, 1));
									}
									if (m != null && m.m_NetState != null && ObjectPropertyList.Enabled)
									{
										m.m_NetState.Send(OPLPacket);
										//foreach ( Item item in m_Items )
										//	m.m_NetState.Send( item.OPLPacket );
									}
								}
								if (!inOldRange && CanSee(m))
								{
									ourState.Send(MobileIncoming.Create(ourState, this, m));
									if (ourState.StygianAbyss)
									{
										if (m.Poisoned)
										{
											ourState.Send(new HealthbarPoison(m));
										}
										if (m.Blessed || m.YellowHealthbar)
										{
											ourState.Send(new HealthbarYellow(m));
										}
									}
									if (m.IsDeadBondedPet)
									{
										ourState.Send(new BondedStatus(0, m.m_Serial, 1));
									}
									if (ObjectPropertyList.Enabled)
									{
										ourState.Send(m.OPLPacket);
										//foreach ( Item item in m.m_Items )
										//	ourState.Send( item.OPLPacket );
									}
								}
							}
						}
						eeable.Free();
					}
					else
					{
						eable = map.GetClientsInRange(newLocation);
						// We're not attached to a client, so simply send an Incoming
						foreach (NetState ns in eable)
						{
							if (((isTeleport && (!ns.HighSeas || !m_NoMoveHS)) || !Utility.InUpdateRange(oldLocation, ns.Mobile.Location)) &&
								ns.Mobile.CanSee(this))
							{
								ns.Send(MobileIncoming.Create(ns, ns.Mobile, this));
								if (ns.StygianAbyss)
								{
									if (m_Poison != null)
									{
										ns.Send(new HealthbarPoison(this));
									}
									if (m_Blessed || m_YellowHealthbar)
									{
										ns.Send(new HealthbarYellow(this));
									}
								}
								if (IsDeadBondedPet)
								{
									ns.Send(new BondedStatus(0, m_Serial, 1));
								}
								if (ObjectPropertyList.Enabled)
								{
									ns.Send(OPLPacket);
									//foreach ( Item item in m_Items )
									//	ns.Send( item.OPLPacket );
								}
							}
						}
						eable.Free();
					}
				}
				OnLocationChange(oldLocation);
				Region.OnLocationChanged(this, oldLocation);
			}
		}

Not the added null checks : m != null

I haven't had the crash since that modification :)

-Rek-
 

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back