Pārlūkot izejas kodu

fixed null access when uploading 0 vertices on empty buffer

Nicolas Cannasse 2 gadi atpakaļ
vecāks
revīzija
e31eeb0980
1 mainītis faili ar 4 papildinājumiem un 0 dzēšanām
  1. 4 0
      h3d/Buffer.hx

+ 4 - 0
h3d/Buffer.hx

@@ -68,12 +68,16 @@ class Buffer {
 			throw "Invalid vertices count";
 		if( format.hasLowPrecision )
 			throw "Can't upload floats on low precision buffer";
+		if( vertices == 0 )
+			return;
 		mem.driver.uploadBufferData(this, startVertice, vertices, buf, bufPos);
 	}
 
 	public function uploadBytes( data : haxe.io.Bytes, dataPos : Int, vertices : Int ) {
 		if( vertices < 0 || vertices > this.vertices )
 			throw "Invalid vertices count";
+		if( vertices == 0 )
+			return;
 		mem.driver.uploadBufferBytes(this, 0, vertices, data, dataPos);
 	}