Distinguish between unset maxInstance and set to 0. (#3949)

This commit is contained in:
Monica Kozbial
2020-06-09 16:38:16 -07:00
committed by GitHub
parent d91b5038c3
commit 8a2caf5c32
2 changed files with 13 additions and 18 deletions

View File

@@ -530,8 +530,11 @@ Blockly.Workspace.prototype.remainingCapacityOfType = function(type) {
if (!this.options.maxInstances) {
return Infinity;
}
return (this.options.maxInstances[type] || Infinity) -
this.getBlocksByType(type, false).length;
var maxInstanceOfType = (this.options.maxInstances[type] !== undefined) ?
this.options.maxInstances[type] : Infinity;
return maxInstanceOfType - this.getBlocksByType(type, false).length;
};
/**