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

If FixedSize is set without a preferred size we should fall back to minimum #2794

Merged
merged 2 commits into from Feb 18, 2022

Conversation

andydotxyz
Copy link
Member

Avoid crashes by being larger than 1x1

Fixes #2784

Checklist:

  • Tests included.
  • Lint and formatter run with no errors.
  • Tests all pass.

if !visible && w.fixedSize && (w.requestedWidth == 0 || w.requestedHeight == 0) {
bigEnough := w.canvas.canvasSize(content.MinSize())
w.Resize(bigEnough)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This look like a bit of duplicated code to me. Would it be possible to put most of the if tests along with the code inside the if in its own function?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah could do. Initially it seemed like longer code - but the duplication is undesirable, will fix

@andydotxyz andydotxyz merged commit 0d0e999 into release/v2.1.x Feb 18, 2022
@andydotxyz andydotxyz deleted the fix/2784 branch February 18, 2022 01:04
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.

None yet

2 participants