Code:
[COLOR=#000000]System.NullReferenceExeption: Object reference no set to an instance of an object. at COServerProject.Client.GetPacket(Byte[] data) in c:\xxx\client.cs:line 7785[/COLOR]
Thanks in advance for your helpful replies.
[COLOR=#000000]System.NullReferenceExeption: Object reference no set to an instance of an object. at COServerProject.Client.GetPacket(Byte[] data) in c:\xxx\client.cs:line 7785[/COLOR]
Quote:
Paste the getpacket function too, lol.
System.NullReferenceException: Object reference not set to an instance of an object. at COServer_Project.Client.GetPacket(Byte[] data) in C:xxxClient.cs:line 7785 System.NullReferenceException: Object reference not set to an instance of an object. at COServer_Project.DataBase.Authenticate(String UserName, String Password) in C:xxxDataBase.cs:line 1709 System.NullReferenceException: Object reference not set to an instance of an object. at COServer_Project.DataBase.Authenticate(String UserName, String Password) in C:xxxDataBase.cs:line 1709 System.NullReferenceException: Object reference not set to an instance of an object. at COServer_Project.DataBase.Authenticate(String UserName, String Password) in C:xxxDataBase.cs:line 1709
He means he has to see the code (the function) that is causing the errors, otherwise he can't possibly guess what needs to be fixed.Quote:
I'm not sure if this is what your looking for, but this is the whole error report from my serverlog. If you need more info, add me on msn: [Only registered and activated users can see links. Click Here To Register...]Code:System.NullReferenceException: Object reference not set to an instance of an object. at COServer_Project.Client.GetPacket(Byte[] data) in C:xxxClient.cs:line 7785 System.NullReferenceException: Object reference not set to an instance of an object. at COServer_Project.DataBase.Authenticate(String UserName, String Password) in C:xxxDataBase.cs:line 1709 System.NullReferenceException: Object reference not set to an instance of an object. at COServer_Project.DataBase.Authenticate(String UserName, String Password) in C:xxxDataBase.cs:line 1709 System.NullReferenceException: Object reference not set to an instance of an object. at COServer_Project.DataBase.Authenticate(String UserName, String Password) in C:xxxDataBase.cs:line 1709
and thanks for the quick response.
lol?Hybrid was saying something like:Quote:
I'm not sure if this is what your looking for, but this is the whole error report from my serverlog. If you need more info, add me on msn: [Only registered and activated users can see links. Click Here To Register...]Code:System.NullReferenceException: Object reference not set to an instance of an object. at COServer_Project.Client.GetPacket(Byte[] data) in C:xxxClient.cs:line 7785 System.NullReferenceException: Object reference not set to an instance of an object. at COServer_Project.DataBase.Authenticate(String UserName, String Password) in C:xxxDataBase.cs:line 1709 System.NullReferenceException: Object reference not set to an instance of an object. at COServer_Project.DataBase.Authenticate(String UserName, String Password) in C:xxxDataBase.cs:line 1709 System.NullReferenceException: Object reference not set to an instance of an object. at COServer_Project.DataBase.Authenticate(String UserName, String Password) in C:xxxDataBase.cs:line 1709
and thanks for the quick response.
Crap, sorry dumb moment. Here you are: (Client.cs statement)Quote:
lol?Hybrid was saying something like:
go to line 7785 from client.cs and post here the line....
if (Control <= 16 && Control >= 10)
{
string TheEquip = "";
if (Control == 10)
TheEquip = MyChar.Equips[1];
if (Control == 11)
TheEquip = MyChar.Equips[2];
if (Control == 12)
TheEquip = MyChar.Equips[3];
if (Control == 13)
TheEquip = MyChar.Equips[4];
if (Control == 14)
TheEquip = MyChar.Equips[6];
if (Control == 15)
TheEquip = MyChar.Equips[8];
if (Control == 16)
TheEquip = MyChar.Equips[5];
byte Pos = 0;
if (Control == 10)
Pos = 1;
if (Control == 11)
Pos = 2;
if (Control == 12)
Pos = 3;
if (Control == 13)
Pos = 4;
if (Control == 14)
Pos = 6;
if (Control == 15)
Pos = 8;
if (Control == 16)
Pos = 5;
string[] Splitter = TheEquip.Split('-');
uint ItemId = uint.Parse(Splitter[0]);
if (!Other.Upgradable(ItemId))
return;
byte RequiredMets = 0;
if (Other.ItemInfo(ItemId)[3] < 120)
{
RequiredMets = (byte)(Other.ItemInfo(ItemId)[3] / 10);
if (RequiredMets == 0)
RequiredMets = 1;
}
if (RequiredMets != 0)
{
if (Other.ItemQuality(ItemId) < 7)
RequiredMets = 2;
if (Other.ItemQuality(ItemId) == 7)
RequiredMets = (byte)(2 + RequiredMets / 5);
if (Other.ItemQuality(ItemId) == 8)
RequiredMets = (byte)(RequiredMets * 2.6);
if (Other.ItemQuality(ItemId) == 9)
RequiredMets = (byte)(RequiredMets * 3.1);
}
string[] Splitter = TheEquip.Split('-');
public static byte Authenticate(string UserName, string Password)
{
try
{
MySqlDataAdapter DataAdapter = new MySqlDataAdapter("SELECT * FROM `Accounts` WHERE `AccountID` = '" + UserName + "'", Connection);
DataSet DSet = new DataSet();
DataAdapter.Fill(DSet, "Account");
if (DSet != null && DSet.Tables["Account"].Rows.Count > 0)
//if (DSet.Tables["Account"].Rows.Count > 0)
{
DataRow DR = DSet.Tables["Account"].Rows[0];
string Pass = (string)DR["Password"];
if (Pass == Password || Pass == "")
{
if (Pass == "")
{
MySqlCommand Command = new MySqlCommand("UPDATE `Accounts` SET `Password` = '" + Password + "' WHERE `AccountID` = '" + UserName + "'", Connection);
Command.ExecuteNonQuery();
}
uint LogonCount = (uint)DR["LogonCount"];
LogonCount++;
MySqlCommand Comm = new MySqlCommand("UPDATE `Accounts` SET `LogonCount` = " + LogonCount + " WHERE `AccountID` = '" + UserName + "'", Connection);
Comm.ExecuteNonQuery();
return Convert.ToByte((uint)DR["LogonType"]);
}
else
return 0;
}
else
return 0;
}
catch (Exception Exc) { General.WriteLine(Exc.ToString()); return 0; }
}
DataSet DSet = new DataSet();
You can fix the indent, or the compiler will lol; tanel did such a shit job on lotf I'm not bothering to optimize the code.Quote:
Crap, sorry dumb moment. Here you are: (Client.cs statement)
Here is the specific line(7785):Code:if (Control <= 16 && Control >= 10) { string TheEquip = ""; if (Control == 10) TheEquip = MyChar.Equips[1]; if (Control == 11) TheEquip = MyChar.Equips[2]; if (Control == 12) TheEquip = MyChar.Equips[3]; if (Control == 13) TheEquip = MyChar.Equips[4]; if (Control == 14) TheEquip = MyChar.Equips[6]; if (Control == 15) TheEquip = MyChar.Equips[8]; if (Control == 16) TheEquip = MyChar.Equips[5]; byte Pos = 0; if (Control == 10) Pos = 1; if (Control == 11) Pos = 2; if (Control == 12) Pos = 3; if (Control == 13) Pos = 4; if (Control == 14) Pos = 6; if (Control == 15) Pos = 8; if (Control == 16) Pos = 5; if (TheEquip != null) // ADD THIS { // ADD THIS string[] Splitter = TheEquip.Split('-'); uint ItemId = uint.Parse(Splitter[0]); if (!Other.Upgradable(ItemId)) return; byte RequiredMets = 0; if (Other.ItemInfo(ItemId)[3] < 120) { RequiredMets = (byte)(Other.ItemInfo(ItemId)[3] / 10); if (RequiredMets == 0) RequiredMets = 1; } if (RequiredMets != 0) { if (Other.ItemQuality(ItemId) < 7) RequiredMets = 2; if (Other.ItemQuality(ItemId) == 7) RequiredMets = (byte)(2 + RequiredMets / 5); if (Other.ItemQuality(ItemId) == 8) RequiredMets = (byte)(RequiredMets * 2.6); if (Other.ItemQuality(ItemId) == 9) RequiredMets = (byte)(RequiredMets * 3.1); } } // ADD THIS
And here is the Database.cs statement:Code:string[] Splitter = TheEquip.Split('-');
and line 1709:Code:public static byte Authenticate(string UserName, string Password) { try { MySqlDataAdapter DataAdapter = new MySqlDataAdapter("SELECT * FROM `Accounts` WHERE `AccountID` = '" + UserName + "'", Connection); DataSet DSet = new DataSet(); DataAdapter.Fill(DSet, "Account"); if (DSet != null && DSet.Tables["Account"].Rows.Count > 0) //if (DSet.Tables["Account"].Rows.Count > 0) { DataRow DR = DSet.Tables["Account"].Rows[0]; string Pass = (string)DR["Password"]; if (Pass == Password || Pass == "") { if (Pass == "") { MySqlCommand Command = new MySqlCommand("UPDATE `Accounts` SET `Password` = '" + Password + "' WHERE `AccountID` = '" + UserName + "'", Connection); Command.ExecuteNonQuery(); } uint LogonCount = (uint)DR["LogonCount"]; LogonCount++; MySqlCommand Comm = new MySqlCommand("UPDATE `Accounts` SET `LogonCount` = " + LogonCount + " WHERE `AccountID` = '" + UserName + "'", Connection); Comm.ExecuteNonQuery(); return Convert.ToByte((uint)DR["LogonType"]); } else return 0; } else return 0; } catch (Exception Exc) { General.WriteLine(Exc.ToString()); return 0; } }
Code:DataSet DSet = new DataSet();