fix NPE when configuring storage busses

This commit is contained in:
PrototypeTrousers
2021-08-01 17:36:23 -03:00
parent cbdad7c58e
commit 09cbfe96d6
2 changed files with 14 additions and 10 deletions
@@ -369,19 +369,23 @@ public class PartStorageBus extends PartUpgradeable implements IGridTickable, IC
boolean denyRead = false;
if( in != null )
{
AccessRestriction currentAccess = ( AccessRestriction ) ( ( ConfigManager ) this.getConfigManager() ).getSetting( Settings.ACCESS );
AccessRestriction oldAccess = ( AccessRestriction ) ( ( ConfigManager ) this.getConfigManager() ).getOldSetting( Settings.ACCESS );
if( oldAccess.hasPermission( AccessRestriction.READ ) && !currentAccess.hasPermission( AccessRestriction.READ ) )
{
denyRead = true;
}
if( accessChanged )
{
AccessRestriction currentAccess = (AccessRestriction) ( (ConfigManager) this.getConfigManager() ).getSetting( Settings.ACCESS );
AccessRestriction oldAccess = (AccessRestriction) ( (ConfigManager) this.getConfigManager() ).getOldSetting( Settings.ACCESS );
if( oldAccess.hasPermission( AccessRestriction.READ ) && !currentAccess.hasPermission( AccessRestriction.READ ) )
{
denyRead = true;
}
in.setBaseAccess( oldAccess );
before = in.getAvailableItems( before );
in.setBaseAccess( currentAccess );
accessChanged = false;
}
else
{
before = in.getAvailableItems( before );
}
before = in.getAvailableItems( before );
accessChanged = false;
in.setBaseAccess( currentAccess );
}
this.cached = false;