From feb9cb907951b0ba0961742ead6ba0a9a761e27b Mon Sep 17 00:00:00 2001 From: Chien Yang Date: Wed, 28 Nov 2007 18:07:20 +0000 Subject: 1) Completed the fix to issue 540. 2) Minor cleanup. git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@875 ba19aa83-45c5-6ac9-afd3-db810772062c --- src/classes/share/javax/media/j3d/GroupRetained.java | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) (limited to 'src/classes') diff --git a/src/classes/share/javax/media/j3d/GroupRetained.java b/src/classes/share/javax/media/j3d/GroupRetained.java index b006df0..f69a14b 100644 --- a/src/classes/share/javax/media/j3d/GroupRetained.java +++ b/src/classes/share/javax/media/j3d/GroupRetained.java @@ -15,7 +15,6 @@ package javax.media.j3d; import java.util.Vector; import java.util.Enumeration; import java.util.ArrayList; -import java.util.Hashtable; /** * Group node. @@ -1089,7 +1088,7 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { newFogs = new ArrayList(); for (int i = 0; i < localToVworldKeys.length; i++) { newFogs.add(new ArrayList()); - }; + } } else { newFogs = new ArrayList(); @@ -1326,18 +1325,18 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { void updatePickable(HashKey keys[], boolean pick[]) { - int nchild = children.size()-1; + int numChildLessOne = children.size() - 1; super.updatePickable(keys, pick); int i=0; NodeRetained child; // Fix for issue 540 - if (children.size()==0) { + if (numChildLessOne < 0) { return; } // End fix for issue 540 - for (i = 0; i < nchild; i++) { + for (i = 0; i < numChildLessOne; i++) { child = (NodeRetained)children.get(i); if(child != null) child.updatePickable(keys, (boolean []) pick.clone()); @@ -1352,12 +1351,18 @@ class GroupRetained extends NodeRetained implements BHLeafInterface { void updateCollidable(HashKey keys[], boolean collide[]) { - int nchild = children.size()-1; + int numChildLessOne = children.size() - 1; super.updateCollidable(keys, collide); int i=0; NodeRetained child; - for (i = 0; i < nchild; i++) { + // Fix for issue 540 + if (numChildLessOne < 0) { + return; + } + // End fix for issue 540 + + for (i = 0; i < numChildLessOne; i++) { child = (NodeRetained)children.get(i); if(child != null) child.updateCollidable(keys, (boolean []) collide.clone()); -- cgit v1.2.3