Fixed a bug in cloning that prevented a null from being usable

as a 'precloned' value.  This made Spatial attempt to clone its
parent.
define_list_fix
Paul Speed 9 years ago
parent 008768f18c
commit 271f6492dd
  1. 4
      jme3-core/src/main/java/com/jme3/util/clone/Cloner.java

@ -207,10 +207,10 @@ public class Cloner {
// Check the index to see if we already have it // Check the index to see if we already have it
Object clone = index.get(object); Object clone = index.get(object);
if( clone != null ) { if( clone != null || index.containsKey(object) ) {
if( log.isLoggable(Level.FINER) ) { if( log.isLoggable(Level.FINER) ) {
log.finer("cloned:" + object.getClass() + "@" + System.identityHashCode(object) log.finer("cloned:" + object.getClass() + "@" + System.identityHashCode(object)
+ " as cached:" + clone.getClass() + "@" + System.identityHashCode(clone)); + " as cached:" + (clone == null ? "null" : (clone.getClass() + "@" + System.identityHashCode(clone))));
} }
return type.cast(clone); return type.cast(clone);
} }

Loading…
Cancel
Save