Fixed NPE and ConcurrentModificationException during cloning TechniqueDef.

This commit is contained in:
javasabr 2017-09-03 16:22:46 +03:00 committed by Rémy Bouquet
parent 32b947a0ac
commit 94f542912b
2 changed files with 8 additions and 1 deletions

View File

@ -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());

View File

@ -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());
}