Bug 977647 -- check for empty arrays in mapPar r=shu

This commit is contained in:
Nicholas D. Matsakis 2014-02-28 11:21:56 -05:00
parent 8c0088f49e
commit 4cd3ac885b
2 changed files with 14 additions and 0 deletions

View File

@ -1438,6 +1438,8 @@ function MapTypedParImplDepth1(inArray, inArrayType, outArrayType, func) {
const mode = undefined;
const outArray = new outArrayType(length);
if (length === 0)
return outArray;
const outGrainTypeIsTransparent = ObjectIsTransparentTypedObject(outArray);

View File

@ -0,0 +1,12 @@
// Check for mapPar() applied to an empty array.
// Public domain.
if (!this.hasOwnProperty("TypedObject"))
quit();
var { ArrayType, StructType, uint32 } = TypedObject;
var Point = new StructType({x: uint32, y: uint32});
var Points = Point.array();
var points = new Points();
points.mapPar(function() {});