JakAttack909 / blockly

Automatically exported from code.google.com/p/blockly
0 stars 0 forks source link

r1170 breaks all example apps #158

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
On line 52 of core/field.js, the added of " && this.sourceBlock_.editable" will 
cause an exception whenever this.CURSOR is true. this.sourceBlock_ is set to 
null unconditionally earlier in the function and afaict nothing with set it.

To reproduce, try running any example app (for instance Maze), Chromium reports 
the error:

Uncaught TypeError: Cannot read property 'editable' of null 

Removing the added condition allows Maze to work.

Original issue reported on code.google.com by agash...@gmail.com on 1 Aug 2013 at 11:22

GoogleCodeExporter commented 8 years ago
same here, my app stoped working when updated to latest revision, changing the 
line to this works and maintains the intention of the check:

 if (this.CURSOR && this.sourceBlock_ && this.sourceBlock_.editable) {

Original comment by luismarianoguerra@gmail.com on 2 Aug 2013 at 8:37

GoogleCodeExporter commented 8 years ago
Same here as well.

Running:

Blockly.Custom.loadDefaultBlocks = function() {
    var defaultXml =
        '<xml>' +
        '    <block type="vResult" deletable="false" x="25" y="25">' +
        '        <value name="VALUE">' +
        '            <block type="math_number">0</block>' +
        '        </value>' +
        '    </block>' +
        '</xml>';

    Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, Blockly.Xml.textToDom(defaultXml));
};

// Definição da variável de resultado
Blockly.Language.vResult = {
    helpUrl: Blockly.LANG_VARIABLES_SET_HELPURL,
    init: function () {
        this.setColour(330);
        this.appendValueInput('VALUE')
            .setCheck('Number')
            .appendTitle('Result =');
        this.setTooltip(Blockly.LANG_VARIABLES_SET_TOOLTIP);
    }
};

Blockly.JavaScript.vResultado = function () {
    // TODO
    return "";
};

$(document).ready(function() {

    // Initialize Blockly
    // ...

    // Load default values
    Blockly.Custom.loadDefaultBlocks();

});

Results in:

Uncaught TypeError: Cannot read property 'editable' of null

Original comment by adriano....@gmail.com on 2 Aug 2013 at 3:24

GoogleCodeExporter commented 8 years ago
Changing the code to be loaded in Blockly to:

<xml>
    <block type="vResultado" deletable="false" x="25" y="25">
        <value name="VALUE">
            <block type="math_number">
                <title name="NUM">0</title>
            </block>
        </value>
    </block>
</xml>

works.

Original comment by adriano....@gmail.com on 2 Aug 2013 at 4:56

GoogleCodeExporter commented 8 years ago
My fault.  The fix is out for code review and will land shortly.

Original comment by neil.fra...@gmail.com on 3 Aug 2013 at 3:05

GoogleCodeExporter commented 8 years ago
Fixed in r1177.  Thanks for the bug report.

Original comment by neil.fra...@gmail.com on 3 Aug 2013 at 3:43