I'm trying to use a try {...} catch
on this statement as it's too large and causes an emulator to crash. When it converts it to a string, that is. So the solution is to make a try {...} catch
.
public override string ToString()
{
return "[" + Header + "] BODY: " +
(PlusEnvironment
.GetDefaultEncoding()
.GetString(Body)
.Replace(Convert.ToChar(0).ToString(), "[0]"));
}
How would I go abouts doing this?
Error:
System.NullReferenceException: Object reference not set to an instance of an object.
at Plus.Messages.Net.GamePacketParser.handlePacketData(Byte[] Data) in C:\Users\Administrator\Desktop\Emulator\Messages\Net\GamePacketParser.cs:line 75
Date/Time: 2018-02-08 13:27:05,435
Thread: 25
Packet Error!
System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at Plus.Communication.Packets.Incoming.ClientPacket.ToString()
at Plus.HabboHotel.GameClients.GameClient.parser_onNewPacket(ClientPacket
Message) at Plus.Messages.Net.GamePacketParser.handlePacketData(Byte[] Data)
Someone said:
I specifically recommend wrapping this line Code: Plus.Communication.Packets.Incoming.ClientPacket.ToString() in a try{}catch block and trying to parse the clientpacket to a string, and catching for the memory exception that you get, that way the packets that are too large won't crash the emulator but they will be ignored and not pass through.