diff --git a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainGrid.java b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainGrid.java index 1bf6e8cb2..79505e8ed 100644 --- a/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainGrid.java +++ b/engine/src/terrain/com/jme3/terrain/geomipmap/TerrainGrid.java @@ -237,8 +237,8 @@ public class TerrainGrid extends TerrainQuad { public TerrainGrid() { } - - private void initData(){ + + private void initData() { int maxVisibleSize = size; this.quarterSize = maxVisibleSize >> 2; this.quadSize = (maxVisibleSize + 1) >> 1; @@ -452,9 +452,11 @@ public class TerrainGrid extends TerrainQuad { offsetAmount = c.readFloat("offsetAmount", 0); terrainQuadGrid = (TerrainQuadGrid) c.readSavable("terrainQuadGrid", null); initData(); - terrainQuadGrid.setSize(this.size); - terrainQuadGrid.setPatchSize(this.patchSize); - terrainQuadGrid.setQuadSize(this.quadSize); + if (terrainQuadGrid != null) { + terrainQuadGrid.setSize(this.size); + terrainQuadGrid.setPatchSize(this.patchSize); + terrainQuadGrid.setQuadSize(this.quadSize); + } } @Override