Fix using ByteArray.writeBytes when bytes.length is 0

This commit is contained in:
Joshua Granick
2014-09-30 11:47:46 -07:00
parent a606b7c87c
commit c7b4f9dd68

View File

@@ -696,6 +696,7 @@ class ByteArray #if !js extends Bytes #end implements ArrayAccess<Int> #if !js i
public function writeBytes (bytes:#if js ByteArray #else Bytes #end, offset:UInt = 0, length:UInt = 0):Void {
if (bytes.length == 0) return;
#if js
if (offset < 0 || length < 0) throw ("Write error - Out of bounds");
if( length == 0 ) length = bytes.length;