diff options
-rw-r--r-- | src/classes/share/javax/media/j3d/Appearance.java | 38 | ||||
-rw-r--r-- | src/classes/share/javax/media/j3d/AppearanceRetained.java | 2 |
2 files changed, 23 insertions, 17 deletions
diff --git a/src/classes/share/javax/media/j3d/Appearance.java b/src/classes/share/javax/media/j3d/Appearance.java index ca60e41..f7e1eff 100644 --- a/src/classes/share/javax/media/j3d/Appearance.java +++ b/src/classes/share/javax/media/j3d/Appearance.java @@ -702,18 +702,21 @@ public class Appearance extends NodeComponent { throw new CapabilityNotSetException(J3dI18N.getString("Appearance20")); // Do illegal sharing check - for(int j=0; j<stateArray.length; j++) { - TextureRetained texRetained = ((TextureUnitStateRetained)stateArray[j].retained).texture; - if(texRetained != null) { - ImageComponent[] images = texRetained.getImages(); - if(images != null) { - for(int i=0; i<images.length; i++) { - validateImageIllegalSharing(images[i]); + if (stateArray != null) { + for(int j=0; j<stateArray.length; j++) { + TextureRetained texRetained = + ((TextureUnitStateRetained)stateArray[j].retained).texture; + if(texRetained != null) { + ImageComponent[] images = texRetained.getImages(); + if(images != null) { + for(int i=0; i<images.length; i++) { + validateImageIllegalSharing(images[i]); + } } } } } - + ((AppearanceRetained)this.retained).setTextureUnitState(stateArray); } @@ -751,17 +754,20 @@ public class Appearance extends NodeComponent { if (!this.getCapability(ALLOW_TEXTURE_UNIT_STATE_WRITE)) throw new CapabilityNotSetException(J3dI18N.getString("Appearance20")); - // Do illegal sharing check - TextureRetained texRetained = ((TextureUnitStateRetained)state.retained).texture; - if(texRetained != null) { - ImageComponent[] images = texRetained.getImages(); - if(images != null) { - for(int i=0; i<images.length; i++) { - validateImageIllegalSharing(images[i]); + // Do illegal sharing check + if (state != null) { + TextureRetained texRetained = + ((TextureUnitStateRetained)state.retained).texture; + if(texRetained != null) { + ImageComponent[] images = texRetained.getImages(); + if(images != null) { + for(int i=0; i<images.length; i++) { + validateImageIllegalSharing(images[i]); + } } } } - + ((AppearanceRetained)this.retained).setTextureUnitState(index, state); } diff --git a/src/classes/share/javax/media/j3d/AppearanceRetained.java b/src/classes/share/javax/media/j3d/AppearanceRetained.java index 904fb50..a6a4383 100644 --- a/src/classes/share/javax/media/j3d/AppearanceRetained.java +++ b/src/classes/share/javax/media/j3d/AppearanceRetained.java @@ -542,7 +542,7 @@ class AppearanceRetained extends NodeComponentRetained { // add the specified texture unit states to this appearance // also make a copy of the array of references to the units - if (stateArray != null) { + if (stateArray != null && stateArray.length > 0) { Object [] args = new Object[2]; |