You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We integrated the latest version of this library, as of the current time I'm writing this (v5.1.0), into our project for displaying some charts. There's an unusual behaviour, but a valid one in the project, that causes the app to crash because of a data cast from Double.infinite to Integer, but the this cast fails as infinite cannot be cast into an Int, and this code resides within the library.
The class in questions is BarLineScatterCandleBubbleRenderer and this is the place where it crashes: open func isDrawingValuesAllowed(dataProvider: ChartDataProvider?) -> Bool { guard let data = dataProvider?.data else { return false } return data.entryCount < Int(CGFloat(dataProvider?.maxVisibleCount ?? 0) * viewPortHandler.scaleX) }
What did you expect to happen?
I would've expected for this CGFloat to be checked against CGFloat.infinity and CGFloat.nan and to return with a false in these cases out of the isDrawingValuesAllowed function.
Also I'd expect this check to be applied to all renderers as it can occur in the other files as well.
What happened instead?
The type cast fails and thus it crashes the host app.
What did you do?
We integrated the latest version of this library, as of the current time I'm writing this (v5.1.0), into our project for displaying some charts. There's an unusual behaviour, but a valid one in the project, that causes the app to crash because of a data cast from Double.infinite to Integer, but the this cast fails as infinite cannot be cast into an Int, and this code resides within the library.
The class in questions is
BarLineScatterCandleBubbleRenderer
and this is the place where it crashes:open func isDrawingValuesAllowed(dataProvider: ChartDataProvider?) -> Bool { guard let data = dataProvider?.data else { return false } return data.entryCount < Int(CGFloat(dataProvider?.maxVisibleCount ?? 0) * viewPortHandler.scaleX) }
What did you expect to happen?
I would've expected for this CGFloat to be checked against
CGFloat.infinity
andCGFloat.nan
and to return with a false in these cases out of theisDrawingValuesAllowed
function.Also I'd expect this check to be applied to all renderers as it can occur in the other files as well.
What happened instead?
The type cast fails and thus it crashes the host app.
DGCharts Environment
**DGCharts version/Branch/Commit Number:5.1.0
**Xcode version:Version 15.4 (15F31d)
**Swift version:5
**Platform(s) running DGCharts:iOS
**macOS version running Xcode:14.5 (23F79)
Demo Project
I'm not adding a demo project as I'm submitting a pull request so i need this ticket created in order to link the PR to this issue.
The text was updated successfully, but these errors were encountered: