Skip to content
This repository has been archived by the owner on Dec 2, 2020. It is now read-only.

BEMLine quadCurvedPathWithPoints: results in index 0 beyond bounds for empty array #271

Open
sjmn opened this issue Aug 31, 2016 · 5 comments

Comments

@sjmn
Copy link

sjmn commented Aug 31, 2016

A workaround hack: If I change line 157 in BEMLine.m from this:
if (!self.disableMainLine && self.bezierCurveIsEnabled) {
to this:
if (!self.disableMainLine && self.bezierCurveIsEnabled && self.points.count && self.bottomPointsArray.count && self.topPointsArray.count) {
it works OK.
This points to an apparent problem with my data array being empty, I think, although that shouldn't be the case. Is there some better way to avoid having BEMLine trying to draw with an empty data set?

I really appreciate using BEMSimpleLineGraph. Thanks for any help.

@Sam-Spencer
Copy link
Collaborator

Hi @sjmn, I'll look into this and get back to you. Could you provide some details on how exactly to replicate the issue?

@sjmn
Copy link
Author

sjmn commented Nov 7, 2016

@Sam-Spencer the problem seems to have resolved itself - I'm now not sure how to replicate - thanks.

@carleihar
Copy link

carleihar commented Nov 28, 2016

@Sam-Spencer I'm replicating by returning BEMNullGraphValue for all my data points, which for me may happen before I'm finished fetching data.

@sjmn
Copy link
Author

sjmn commented Dec 1, 2016

thanks @carleihar - yes same for me if array only contains null values and then my code returns BEMNullGraphValue in the - (CGFloat)lineGraph:(BEMSimpleLineGraphView *)graph valueForPointAtIndex:(NSInteger)index method. I'm adding a zero value to the beginning of all of my data arrays to get around this for now. Have you found any other solution?

@carleihar
Copy link

@sjmn Right now I am checking to see if my points array is empty, and if it is just removing the graph from the superview. Definitely not a pretty solution but it works.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants