Fix headless procedure arguments (issue 268).

This commit is contained in:
Neil Fraser
2015-03-08 19:17:12 -07:00
parent 1214b8cca8
commit 7414c59b89
3 changed files with 7 additions and 4 deletions

View File

@@ -808,7 +808,7 @@ Blockly.Block.prototype.setCollapsed = function(collapsed) {
*/
Blockly.Block.prototype.toString = function(opt_maxLength) {
var text = [];
if(this.collapsed_) {
if (this.collapsed_) {
text.push(this.getInput('_TEMP_COLLAPSED_INPUT').fieldRow[0].text_);
} else {
for (var i = 0, input; input = this.inputList[i]; i++) {

View File

@@ -202,6 +202,9 @@ Blockly.Input.prototype.setAlign = function(align) {
* Initialize the fields on this input.
*/
Blockly.Input.prototype.init = function() {
if (!this.sourceBlock_.workspace.rendered) {
return; // Headless blocks don't need fields initialized.
}
for (var x = 0; x < this.fieldRow.length; x++) {
this.fieldRow[x].init(this.sourceBlock_);
}