Blockly: Exception when try to move blocks within blockly div when blocks start shaking

Created on 29 Aug 2019  路  7Comments  路  Source: google/blockly

Describe the bug

Exception in the developer console when trying to move blocks after blocks start shaking

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://blockly-demo.appspot.com/static/demos/fixed/index.html
  2. Open developer console
  3. Drag blocks in the blockly area over each other until there is no space left or blocks start shaking.
  4. Now remove any block by putting it back
  5. Notice this exception :
    blockly_compressed.js:1802 Uncaught TypeError: Cannot read property 'getRootBlock' of null
    at blockly_compressed.js:1802
    at Blockly.WorkspaceSvg.Blockly.Workspace.fireChangeListener (blockly_compressed.js:1016)
    at Blockly.Events.fireNow_ (blockly_compressed.js:917)

Expected behavior

There should not be any error

Capture

Video showing the steps
Video.zip

ChromeOS : 74.0.3729.159 (Official Build) (64-bit)
Platform: 11895.118.0 (Official Build)
JavaScript: V8 7.4.288.28
Flash: 32.0.0.171

bug

All 7 comments

Definitely a bug, but things seem to keep working after the error so lower priority to fix.

@RoboErikG Can we just handle the exception instead of throwing it?

@ankuraga1508 that would just hide the bug without fixing it and could cause more issues later on.

@NeilFraser I thought I fixed this when I fixed the shaking, but that must not have been the root problem. I can take a look in an hour or two.

Here are some simpler repro steps:

  1. Load the Fixed demo: /demos/fixed/index.html
  2. Open the developer console, and run the following:
Blockly.Xml.domToWorkspace(Blockly.mainWorkspace, Blockly.Xml.textToDom(`<xml xmlns="https://developers.google.com/blockly/xml">
  <block type="controls_repeat_ext" x="11" y="0">
    <statement name="DO">
      <block type="controls_repeat_ext">
        <next>
          <block type="controls_repeat_ext">
            <next>
              <block type="controls_repeat_ext">
                <next>
                  <block type="controls_repeat_ext">
                    <next>
                      <block type="controls_repeat_ext">
                        <next>
                          <block type="controls_repeat_ext">
                            <statement name="DO">
                              <block type="controls_repeat_ext"/>
                            </statement>
                            <next>
                              <block type="controls_repeat_ext"/>
                            </next>
                          </block>
                        </next>
                      </block>
                    </next>
                  </block>
                </next>
              </block>
            </next>
          </block>
        </next>
      </block>
    </statement>
  </block>
</xml>`))
  1. Drag the inner most repeat block into the flyout to delete it.
  2. See exception in console.

This was fixed by #3394

Was this page helpful?
3 / 5 - 1 ratings