Skip to content

fix: div by zero in SegmentedBar#1601

Merged
abhinayagarwal merged 3 commits into
controlsfx:masterfrom
jixxed:bugfix/#1589-div-by-zero
Oct 31, 2025
Merged

fix: div by zero in SegmentedBar#1601
abhinayagarwal merged 3 commits into
controlsfx:masterfrom
jixxed:bugfix/#1589-div-by-zero

Conversation

@jixxed

@jixxed jixxed commented Oct 27, 2025

Copy link
Copy Markdown

Fixes #1589

A total of 0 results in a NaN due to a division by 0 and consequently results in the high CPU load described in #1589
This PR sets the segmentWidth or segmentHeight to 0 if the total is 0

@github-actions

Copy link
Copy Markdown

Hi jixxed,

Welcome to ControlsFX and thank you for taking time to contribute to this project.

We do not recognise you as a contributor. Can you please sign ControlsFX Individual Contributor Agreement: https://cla.controlsfx.org ?

@github-actions github-actions Bot added the CLA label Oct 27, 2025

@danielpeintner danielpeintner left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

Didn't run the tests but simply looking at your code the change makes sense and should avoid div by zero

@abhinayagarwal abhinayagarwal changed the title Bugfix/#1589 div by zero fix: div by zero in SegmentedBar Oct 31, 2025
@abhinayagarwal abhinayagarwal merged commit 84c7b44 into controlsfx:master Oct 31, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SegmentedBar div/0

3 participants