Prechádzať zdrojové kódy

Fixed a bug in cloning that prevented a null from being usable
as a 'precloned' value. This made Spatial attempt to clone its
parent.

Paul Speed 9 rokov pred
rodič
commit
271f6492dd

+ 2 - 2
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
         Object clone = index.get(object);
-        if( clone != null ) {
+        if( clone != null || index.containsKey(object) ) {
             if( log.isLoggable(Level.FINER) ) {
                 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);
         }