0
Answer

HELP; system.nullreferenceexeption

Kenneth  Wallace

Kenneth Wallace

16y
3.1k
1
I am receiving the following error:

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

Here is the 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;

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);
}


and this is line 7785:

string[] Splitter = TheEquip.Split('-');

Please contact me through MSN or e-mail to help me with this error. Thank you in advance for any help you can give.