Reorder checks to prevent malformed packets throwing errors

This commit is contained in:
md_5 2013-06-02 22:19:49 +10:00
parent eaf99cf4a6
commit 340d82812a
2 changed files with 3 additions and 3 deletions

View File

@ -266,12 +266,12 @@ public class ServerConnector extends PacketHandler
@Override
public void handle(PacketFAPluginMessage pluginMessage) throws Exception
{
if ( pluginMessage.equals( PacketConstants.I_AM_BUNGEE) )
if ( pluginMessage.equals( PacketConstants.I_AM_BUNGEE ) )
{
throw new IllegalStateException( "May not connect to another BungeCord!" );
}
if ( ( pluginMessage.getData()[0] & 0xFF ) == 0 && pluginMessage.getTag().equals( "FML" ) )
if ( pluginMessage.getTag().equals( "FML" ) && ( pluginMessage.getData()[0] & 0xFF ) == 0 )
{
ByteArrayDataInput in = ByteStreams.newDataInput( pluginMessage.getData() );
in.readUnsignedByte();

View File

@ -111,7 +111,7 @@ public class UpstreamBridge extends PacketHandler
throw new CancelSendSignal();
}
// Hack around Forge race conditions
if ( ( pluginMessage.getData()[0] & 0xFF ) == 1 && pluginMessage.getTag().equals( "FML" ) )
if ( pluginMessage.getTag().equals( "FML" ) && ( pluginMessage.getData()[0] & 0xFF ) == 1 )
{
throw new CancelSendSignal();
}