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

App is crashing when line chart is scrolled into view and then back out. #238

Closed
BrandonShega opened this issue Jul 23, 2015 · 1 comment

Comments

@BrandonShega
Copy link

So I have a collection view that has 8 items arranged single row (so it basically looks like a tableview). If I scroll the line chart into view and then out my app crashes saying fatal error: unexpectedly found nil while unwrapping an Optional value

It breaks on line 519 of LineChartRenderer.swift if I follow the code it looks like it's really stemming from here:

    public func entryIndex(xIndex x: Int) -> Int
    {
        var low = 0
        var high = _yVals.count - 1
        var closest = -1

        while (low <= high)
        {
            var m = (high + low) / 2
            var entry = _yVals[m]

            if (x == entry.xIndex)
            {
                while (m > 0 && _yVals[m - 1].xIndex == x)
                {
                    m--
                }

                return m
            }

            if (x > entry.xIndex)
            {
                low = m + 1
            }
            else
            {
                high = m - 1
            }

            closest = m
        }

        return closest
    }

The only thing I can think of is _yVals is 0 but it's only crashing like this on the line chart. We have 1 line chart and 7 bar charts, is this just saying that the data set is nil?

Thanks!

@avishaan
Copy link
Contributor

@BrandonShega I'm having the same issue. How did you resolve yours?

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

No branches or pull requests

2 participants