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

Adding existence check for this.canvas on object stacking mixins #6207

Merged
merged 2 commits into from
Mar 12, 2020
Merged

Adding existence check for this.canvas on object stacking mixins #6207

merged 2 commits into from
Mar 12, 2020

Conversation

paulconlin
Copy link
Contributor

Looks to resolve Cannot read property 'bringToFront' of undefined #6065

I was having instances where the canvas instance was null and bringToFront was being called. I added this existence check to all of the object stacking mixins and matches the approach to check for this.group in the if block above.

@asturur
Copy link
Member

asturur commented Mar 8, 2020

you forgot all the if after the else keyword. Indeed is not building.

@asturur
Copy link
Member

asturur commented Mar 8, 2020

you can also have this.canvas && this.canvas.bringTo... if you want.
Is the same for me, the difference in bytes saved is minimal

@paulconlin
Copy link
Contributor Author

🤦‍♂️sorry about that, updating now

@paulconlin
Copy link
Contributor Author

Opted to stay with the else block, but can update to this.canvas && if you'd like

@asturur
Copy link
Member

asturur commented Mar 12, 2020

is fine as it is!

@asturur asturur merged commit fd466a0 into fabricjs:master Mar 12, 2020
asturur pushed a commit that referenced this pull request Mar 12, 2020
@asturur asturur mentioned this pull request Mar 12, 2020
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants