-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 undefined in vertical flyout layout function#7523 #7535
fix : Check for undefined in vertical flyout layout function#7523 #7535
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome! It looks like this is your first pull request in Blockly, so here are a couple of tips:
-
You can find tips about contributing to Blockly and how to
validate your changes on our
developer site. -
All contributors must sign the Google Contributor License
Agreement (CLA). If the google-cla bot leaves a comment on this
PR, make sure you follow the instructions. -
We use conventional commits
to make versioning the package easier. Make sure your commit
message is in the proper format
or learn how to fix it. -
If any of the other checks on this PR fail, you can click on
them to learn why. It might be that your change caused a test
failure, or that you need to double-check the
style guide.
Thank you for opening this PR! A member of the Blockly team will review it soon.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @patelb268,
Thank you for opening this pull request! It needs just a few things before it's ready to merge:
- Follow the google-cla bot's instructions to sign our CLA and refresh the check
- Address the comment left in the PR review below
- Run
npm run format
to automatically format the code to pass the rest of the CI checks
After that, things should be ready to merge! Thank you for your contribution!
@@ -233,22 +233,25 @@ export class VerticalFlyout extends Flyout { | |||
for (let i = 0, item; (item = contents[i]); i++) { | |||
if (item.type === 'block') { | |||
const block = item.block; | |||
if(block == undefined || block == null){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can simplify this line to just:
if (block) {
Hi Prayag, another contributor also fixed this issue and we've merged that one. Sorry for the mixup, and thanks for the PR. I hope you enjoyed OSD! |
The basics
The details
In layout_ in flyout_vertical.ts we access the block with const block = item.block. The result is nullable
Resolves
so all later uses of block have to have a [non-null assertion]
Fixes
Check for undefined in vertical flyout layout function#7523
Proposed Changes
Check whether block is undefined after setting const block = item.block.
continue if block doesn't exist.
Remove ! from after the remaining uses of block within the for loop.
Reason for Changes
Test Coverage
Documentation
Additional Information