-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Check for empty array in thrasos.RenderInfo.addElemSpacing_ #6211
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Thanks for reporting this! Is your application open source/otherwise available to take a look? I'm a bit confused about how an undefined value is getting in the elements array in the first place; the change works around that, but row.js declares the type of the elements array as |
I've managed to prepare a small example to reproduce this issue: https://codepen.io/zauzolkov/pen/ZErwXMG Steps to reproduce:
I found that the problem is present when |
Probably related issue: #6135 |
This reverts commit f2e57c0.
- Use same array length check as geras renderer does
After some debugging… Looks like I found possible roots of this issue, where pushing of https://github.com/google/blockly/blob/master/core/renderers/geras/info.js#L140-L144 |
Thanks a bunch for digging into this, I think you're exactly right that that's the root cause! |
The basics
npm run format
andnpm run lint
The details
This pull-request was edited after digging for roots of the problem.
Resolves
#6135
Proposed Changes
Check for possibleundefined
value inmeasure
method ofBlockly.blockRendering.InputRow
class.Blockly.thrasos.RenderInfo.addElemSpacing_
method.Behavior Before Change
There is no check forundefined
value inmeasure
method ofBlockly.blockRendering.InputRow
class.Blockly.thrasos.RenderInfo.addElemSpacing_
method.undefined
value inelements
array of InputRow (because of attempt to access a non-existent property):InputRow.measure
method throwsUncaught TypeError: elem is undefined
.Behavior After Change
measure
method ofInputRow
will continue loop onundefined
value instead of throwing error.Blockly.thrasos.RenderInfo.addElemSpacing_
method is checking for empty array just likecommon
andgeras
renderers does.Reason for Changes
This issue was discovered in process of development of custom Blockly-based application with integrated block-plus-minus plugin.
In some cases, it causes endless freeze of entire Blockly workspace after clicking "plus" button (attempt to add user-defined argument) on "Procedure" block (with active "block-plus-minus" plugin).
Test Coverage
Documentation
N/A
Additional Information
This error can break the entire rendering process of workspace, it will infinitely throw
Uncaught TypeError: this.blockDragger_ is null
in console on any gesture or mouse move. The Blockly workspace becomes unusable after triggering this error.