Fixed NPE and ConcurrentModificationException during cloning TechniqueDef.

fix-456
javasabr 7 years ago committed by Rémy Bouquet
parent 32b947a0ac
commit 94f542912b
  1. 8
      jme3-core/src/main/java/com/jme3/material/ShaderGenerationInfo.java
  2. 1
      jme3-core/src/main/java/com/jme3/material/TechniqueDef.java

@ -190,7 +190,13 @@ public class ShaderGenerationInfo implements Savable, Cloneable {
@Override
protected ShaderGenerationInfo clone() throws CloneNotSupportedException {
ShaderGenerationInfo clone = (ShaderGenerationInfo) super.clone();
final ShaderGenerationInfo clone = (ShaderGenerationInfo) super.clone();
clone.attributes = new ArrayList<>();
clone.vertexUniforms = new ArrayList<>();
clone.fragmentUniforms = new ArrayList<>();
clone.fragmentGlobals = new ArrayList<>();
clone.unusedNodes = new ArrayList<>();
for (ShaderNodeVariable attribute : attributes) {
clone.attributes.add(attribute.clone());

@ -801,6 +801,7 @@ public class TechniqueDef implements Savable, Cloneable {
clone.paramToDefineId.putAll(paramToDefineId);
if (shaderNodes != null) {
clone.shaderNodes = new ArrayList<>();
for (ShaderNode shaderNode : shaderNodes) {
clone.shaderNodes.add(shaderNode.clone());
}

Loading…
Cancel
Save