summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKevin Rushforth <[email protected]>2006-11-08 17:17:42 +0000
committerKevin Rushforth <[email protected]>2006-11-08 17:17:42 +0000
commit8c8f6efb41a235736cf6225cc331f971c0974b15 (patch)
treecfd1e326836ca6d9ef7aa95ffe6ca862917d4b42
parent95d2d432722b486b3907d15169a4742a4dba0b7f (diff)
Fixed issue 238: Exception in thread "J3D-MasterControl-1" when setting TextureUnitState to 0-length array
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@744 ba19aa83-45c5-6ac9-afd3-db810772062c
-rw-r--r--src/classes/share/javax/media/j3d/Appearance.java38
-rw-r--r--src/classes/share/javax/media/j3d/AppearanceRetained.java2
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];