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

This commit is contained in:
Paul Speed 2018-03-24 14:45:11 -04:00 committed by Stephen Gold
parent c09014dd1d
commit 72eac2c738

View File

@ -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;