浏览代码

Fixed an NPE when jmeClone() was asked to clone a null.

Paul Speed 9 年之前
父节点
当前提交
68ace33dbd
共有 1 个文件被更改,包括 3 次插入0 次删除
  1. 3 0
      jme3-core/src/main/java/com/jme3/util/clone/Cloner.java

+ 3 - 0
jme3-core/src/main/java/com/jme3/util/clone/Cloner.java

@@ -354,6 +354,9 @@ public class Cloner {
      *  clone() and objects without necessarily knowing their real type.</p>
      */
     public <T> T javaClone( T object ) throws CloneNotSupportedException {
+        if( object == null ) {
+            return null;
+        }
         Method m = methodCache.get(object.getClass());
         if( m == null ) {
             try {