diff --git a/lib/corereqs.js b/lib/corereqs.js index 5a93de0..f7ecb91 100644 --- a/lib/corereqs.js +++ b/lib/corereqs.js @@ -213,13 +213,16 @@ function packValueMask(reqname, values) if (!reqValueMask) throw new Error(reqname + ': no value mask description'); - for (var v in values) + for (var value in values) { - var valueBit = reqValueMask[v].mask; - if (!valueBit) - throw new Error(reqname + ': incorrect value param ' + v); - masksList.push(valueBit); - bitmask |= valueBit; + var v = reqValueMask[value]; + if (v) { + var valueBit = v.mask; + if (!valueBit) + throw new Error(reqname + ': incorrect value param ' + value); + masksList.push(valueBit); + bitmask |= valueBit; + } } /* numeric sort */ diff --git a/test/configure-window.js b/test/configure-window.js index 00ec6ba..ec03103 100644 --- a/test/configure-window.js +++ b/test/configure-window.js @@ -82,7 +82,19 @@ describe('ConfigureWindow', function() { this.X.LowerWindow(this.wid); }); + it('should ignore invalid mask values', function(done) { + this.X.once('event', function(ev) { + ev.x.should.equal(0); + done(); + }); + + this.X.ConfigureWindow(this.wid, { foo : 3, x : 0 }, function(err) { + console.log(err); + }); + }); + after(function(done) { + this.X.removeAllListeners('event'); this.X.DestroyWindow(this.wid); this.X.DestroyWindow(this.wid_helper); this.X.on('end', done);