Fix crash when ordering categories by value with null coordinates#7855
Open
SAY-5 wants to merge 2 commits into
Open
Fix crash when ordering categories by value with null coordinates#7855SAY-5 wants to merge 2 commits into
SAY-5 wants to merge 2 commits into
Conversation
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
Contributor
|
Thanks for the PR! I'll review this and follow up with you. |
camdecoster
reviewed
Jun 30, 2026
camdecoster
left a comment
Contributor
There was a problem hiding this comment.
This is a good fix. I left you one comment.
|
|
||
| // Skip points whose position is not a valid category | ||
| // (e.g. a null/NaN coordinate maps to BADNUM) | ||
| if(!(catIndex + 1)) continue; |
Contributor
There was a problem hiding this comment.
This works and I know it shows up elsewhere in the repo, but it's a bit confusing. What do you think of changing to this?
Suggested change
| if(!(catIndex + 1)) continue; | |
| if (catIndex == null || catIndex < 0) continue; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7840.
When
categoryorderis set to a value-based order (e.g.sum descending,total ascending),sortAxisCategoriesByValuecollects per-category values by indexingcategoriesValue[catIndex]. A data point with anull/NaNcategory coordinate maps toBADNUM, socatIndexisundefinedandcategoriesValue[catIndex][1]throwsTypeError: Cannot read properties of undefined (reading '1'), leaving the chart blank.This skips points whose position is not a valid category, using the same
catIndex + 1guard already applied in the 2dMap branch above. Such points carry no category to order anyway. Added a regression test for a bar chart with anullx andsum descending.