From 72eac2c73888d0019a2c0f98ea1b9d4f391f4848 Mon Sep 17 00:00:00 2001 From: Paul Speed Date: Sat, 24 Mar 2018 14:45:11 -0400 Subject: [PATCH] Fixed an NPE in getNumElements() if the data field was null. --- jme3-core/src/main/java/com/jme3/scene/VertexBuffer.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jme3-core/src/main/java/com/jme3/scene/VertexBuffer.java b/jme3-core/src/main/java/com/jme3/scene/VertexBuffer.java index 70d40a64c..001cf570d 100644 --- a/jme3-core/src/main/java/com/jme3/scene/VertexBuffer.java +++ b/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;