1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-11 05:43:33 +00:00

1. fixed bug, where return value was set incorrectly when calling _write

2. updated behavior, so if unshift is called with zero length buffer, it is a no-op
This commit is contained in:
Bryan Roe
2019-01-28 10:42:20 -08:00
parent 559928de5b
commit ba4028d2d6
2 changed files with 12 additions and 4 deletions

View File

@@ -910,8 +910,12 @@ duk_ret_t ILibDuktape_ReadableStream_unshift(duk_context *ctx)
else
{
duk_size_t bufferLen;
rs->unshiftReserved = (char*)Duktape_GetBuffer(ctx, 0, &bufferLen);
duk_push_int(ctx, rs->UnshiftHandler(rs, (int)bufferLen, rs->user));
char *unshiftBuffer = (char*)Duktape_GetBuffer(ctx, 0, &bufferLen);
if (bufferLen > 0)
{
rs->unshiftReserved = unshiftBuffer;
duk_push_int(ctx, rs->UnshiftHandler(rs, (int)bufferLen, rs->user));
}
return(1);
}
}