From 384abcec961e4c827fb00e1f124986f5def0a9ab Mon Sep 17 00:00:00 2001 From: Adubbz Date: Tue, 19 Jan 2016 12:56:55 +1100 Subject: [PATCH] Fixed a crash with disabling river gen --- .../common/world/layer/GenLayerRiverMixBOP.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/java/biomesoplenty/common/world/layer/GenLayerRiverMixBOP.java b/src/main/java/biomesoplenty/common/world/layer/GenLayerRiverMixBOP.java index 11638a449..2db803c44 100644 --- a/src/main/java/biomesoplenty/common/world/layer/GenLayerRiverMixBOP.java +++ b/src/main/java/biomesoplenty/common/world/layer/GenLayerRiverMixBOP.java @@ -76,14 +76,18 @@ public class GenLayerRiverMixBOP extends BOPGenLayer private boolean biomeSupportsRivers(int biomeId) { - BiomeGenBase biome = BiomeGenBase.getBiome(biomeId); - - if (biome != null && biome instanceof BOPBiome) + //Check if the biome id is valid + if (biomeId >= 0 && biomeId <= BiomeGenBase.getBiomeGenArray().length) { - BOPBiome bopBiome = (BOPBiome)biome; - return bopBiome.canGenerateRivers; + BiomeGenBase biome = BiomeGenBase.getBiome(biomeId); + + if (biome != null && biome instanceof BOPBiome) + { + BOPBiome bopBiome = (BOPBiome)biome; + return bopBiome.canGenerateRivers; + } } - + return true; } } \ No newline at end of file