Explorar o código

Fixed an NPE in getNumElements() if the data field was null.

Paul Speed %!s(int64=7) %!d(string=hai) anos
pai
achega
0fb5eeddd7
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      jme3-core/src/main/java/com/jme3/scene/VertexBuffer.java

+ 3 - 0
jme3-core/src/main/java/com/jme3/scene/VertexBuffer.java

@@ -606,6 +606,9 @@ public class VertexBuffer extends NativeObject implements Savable, Cloneable {
      * @return The total number of data elements in the data buffer.
      */
     public int getNumElements(){
+        if( data == null ) {
+            return 0;
+        }
         int elements = data.limit() / components;
         if (format == Format.Half)
             elements /= 2;