Skip to content
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: prevent crash when clicking on a field to delete a block #7621

Merged
merged 4 commits into from
Nov 1, 2023

Conversation

Apoorvgarg-creator
Copy link
Contributor

The basics

The details

Resolves

Fixes #7587

Proposed Changes

The change is to check if the block is dead or is in dying state before accessing it in the bringToFront function.

Reason for Changes

Test Coverage

Documentation

Additional Information

@Apoorvgarg-creator Apoorvgarg-creator changed the title Fix: #7587 Issue Fix: #7587 Oct 31, 2023
@Apoorvgarg-creator Apoorvgarg-creator changed the title Issue Fix: #7587 Patch - Crash if a field click deletes a block Oct 31, 2023
@Apoorvgarg-creator Apoorvgarg-creator changed the title Patch - Crash if a field click deletes a block fix: prevent crash when clicking on a field to delete a block Oct 31, 2023
@github-actions github-actions bot added the PR: fix Fixes a bug label Oct 31, 2023
@BeksOmega BeksOmega assigned BeksOmega and unassigned cpcallen Oct 31, 2023
@BeksOmega BeksOmega requested review from BeksOmega and removed request for cpcallen October 31, 2023 15:20
Copy link
Collaborator

@BeksOmega BeksOmega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Heya @Apoorvgarg-creator Thank you for your work on this :D

I gave it a look and I /think/ we can move the isDeadOrDying check out of the loop, so that it's at the top of the function. Can you give that a try for me and tell me if it works?

Comment on lines 1187 to 1188
const isDeadOrDying: boolean = block.isDeadOrDying();
if (isDeadOrDying) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you're immediately checking it, there's no need to store the value in a temp variable!

Suggested change
const isDeadOrDying: boolean = block.isDeadOrDying();
if (isDeadOrDying) {
if (block.isDeadOrDying()) {

Copy link
Collaborator

@BeksOmega BeksOmega left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thank you for the fix @Apoorvgarg-creator =)

@BeksOmega BeksOmega merged commit 10024bd into google:develop Nov 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: fix Fixes a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Crash if a field click deletes a block
3 participants