added a null check to network merge

This commit is contained in:
DarkGuardsman 2013-11-27 08:56:18 -05:00
parent 186a564717
commit 3ffe18367b

View file

@ -160,17 +160,17 @@ public class NetworkTileEntities implements ITileNetwork
/** Processing that needs too be done before the network merges. Use this to do final network
* merge calculations and to cause network merge failure
*
*
* @param network the network that is to merge with this one
* @param part the part at which started the network merge. Use this to cause damage if two
* networks merge with real world style failures
*
*
* @return false if the merge needs to be canceled.
*
*
* Cases in which the network should fail to merge are were the two networks merge with error.
* Or, in the case of pipes the two networks merge and the merge point was destroyed by
* combination of liquids.
*
*
* Ex Lava and water */
public boolean preMergeProcessing(ITileNetwork network, INetworkPart part)
{
@ -182,10 +182,17 @@ public class NetworkTileEntities implements ITileNetwork
protected void mergeDo(ITileNetwork network)
{
ITileNetwork newNetwork = NetworkUpdateHandler.createNewNetwork(NetworkUpdateHandler.getID(this.getClass()));
newNetwork.getMembers().addAll(this.getMembers());
newNetwork.getMembers().addAll(network.getMembers());
newNetwork.onCreated();
this.invalidate();
if (newNetwork != null)
{
newNetwork.getMembers().addAll(this.getMembers());
newNetwork.getMembers().addAll(network.getMembers());
newNetwork.onCreated();
this.invalidate();
}
else
{
System.out.println("[CoreMachine]NetworkTileEntities: Failed to merge network due to network creation failure");
}
}
@Override