Hi Guys i am here for request Help with my Important problem with a Player Login Crash.

Sometimes when player of my shard Login, the server Crashing with this CrashLog:

Server Crash Report
===================

RunUO Version 0.5, Build 5458.41239
Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
.NET Framework: 4.0.30319.296
Time: 27/12/2014 22:53:02
Mobiles: 55952
Items: 899163
Exception:
System.NullReferenceException: Object reference not set to an instance of an object.
in Server.Mobiles.PlayerMobile.OnLogin(LoginEventArgs e)
in Server.LoginEventHandler.Invoke(LoginEventArgs e)
in Server.Network.PacketHandlers.DoLogin(NetState state, Mobile m) in c:\Users\Administrator\Desktop\Backup Totale UOTale\Server\Network\PacketHandlers.cs:riga 2433
in Server.Network.PacketHandlers.LoginTimer.OnTick() in c:\Users\Administrator\Desktop\Backup Totale UOTale\Server\Network\PacketHandlers.cs:riga 2224
in Server.Timer.Slice() in c:\Users\Administrator\Desktop\Backup Totale UOTale\Server\Timer.cs:riga 386
in Server.Core.Main(String[] args) in c:\Users\Administrator\Desktop\Backup Totale UOTale\Server\Main.cs:riga 629

Clients:
- Count: 10
+ 93.41.226.195: (account = player1) (mobile = 0x18922 'Vash')
+ 93.41.226.195: (account = player2) (mobile = 0x1A015 'Peter Parker')
+ 93.36.49.110: (account = olaf37xx) (mobile = 0x15AC9 'Banshee')
+ 93.44.209.120: (account = pettero) (mobile = 0x1675D 'Galandor')
+ 79.9.127.24: (account = leonardo) (mobile = 0xCE3B 'Goffredo')
+ 93.44.209.120: (account = simolapeste) (mobile = 0xCCCD 'SimoLaPeste')
+ 79.52.113.40: (account = Deastroyer) (mobile = 0x16B06 'Abigor The Evil')
+ 93.41.226.195: (account = Tony) (mobile = 0x83D1 'Kage')
+ 46.227.0.166: (account = DrTroll) (mobile = 0x15ABE 'Ghoul')
+ 89.15.237.88: (account = andrea82) (mobile = 0x8058 'Phate')


In my shard i have added a Donation Coin System Reward that Give to Plare some Coins in base of Player Login Minute on Day.

OnLogin Fuction in PlayerMobile :

private static void OnLogin(LoginEventArgs e)
{
Mobile from = e.Mobile;

if (from == null)
return;

Account acc = from.Account as Account;

if (acc == null)
return;

if (acc.GetTag("Donation") == "Received")
{
if (acc.DCActiveMin >= 120)
Timer.DelayCall(TimeSpan.FromSeconds(10), ((PlayerMobile)@from).GiveDC);
}

if ( DateTime.Now > acc.PremiumTime )
acc.SetTag("Premium", "Inactive");

ecc...


GiveDC Function in PlayerMobile

public void GiveDC()
{
Account acc = this.Account as Account;
int c = 0;

if (this == null || acc == null)
return;

for (int i = 0; acc.DCActiveMin >= 120; ++i)
{
if (this.BankBox != null)
{
Item don = this.BankBox.FindItemByType(typeof(DonationCoinsToken));

if (don != null)
{
DonationCoinsToken dc = don as DonationCoinsToken;
dc.Worth += 1;
}
else
{
this.BankBox.DropItem( new DonationCoinsToken(1) );
}
}
else if (this.Backpack != null)
{
Item don = this.Backpack.FindItemByType(typeof(DonationCoinsToken));

if (don != null)
{
DonationCoinsToken dc = don as DonationCoinsToken;
dc.Worth += 1;
}
else
{
this.Backpack.DropItem( new DonationCoinsToken(1) );
}
}

acc.DCActiveMin -= 120;
c += 1;
}

this.SendMessage("You Receive a Donation Check of {0} Amount for Your Loyalty", c);
}


Can someone Help me iwth this Crash. Donaction Coins System dont give me Problem in thelast Days.

I add to Post the File listed on Crash Report
 

Attachments

  • Player Login Crash + File.rar
    277.2 KB · Views: 2
Why ?? If player gain 120 Donation Coins, the loop Start and I increase.

If player dont have DC the loop dont starts.
When Player receive DC "acc.DCActive -= 120", the Lopp block becouse DCActive is < 120
 
@arphile, technically his function is correct. Even though i is growing, it is never used or checked, so the only important part of the 'for' loop is the "acc.DCActiveMin >= 120" part.

It probably would have made more sense to use:

Code:
while (acc.DCActiveMin >= 120)
{
	Do stuff;
}

@Actarus, I think we need to see your 'Account.cs' and/or 'Accounts.cs' files. Is it possible the value of DCActiveMin could become very high, like over 2 million?
 
Every save or player logout. DCActiveMin (if > 120) was resetted and his value was converted in donation coin ( 1 DonationCoin every 120 DCActiveMin ).

DCActiveMin was added 1 every 1 minute login session, and is little number in 1 day. Max 3600

In the last day sfter first post i dont have crash

Brfore first crash i add this control on 2 function

if (acc == null)
return;

Maybe player logout while GIveDc function start and script dont find player logged for give dc
 
Account acc = this.Account as Account;
int c = 0;
if (this == null || acc == null)
return;

Change that to this one below, just in case it's "this.Account" that is causing the crash:

Code:
if (this == null) return;

Account acc = this.Account as Account;
int c = 0;

if (acc == null)
return;
 
Back