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

Page count could be zero which causes crash #19

Open
yllow opened this issue Aug 30, 2016 · 1 comment
Open

Page count could be zero which causes crash #19

yllow opened this issue Aug 30, 2016 · 1 comment

Comments

@yllow
Copy link

yllow commented Aug 30, 2016

I was working on dynamic view pager. Since the library is listening to the adapter changes, i notice that there is a function called reset state where the pageCount - 1 should handle properly as the page count could go to zero.

@Zhelyazko
Copy link

Zhelyazko commented Sep 2, 2016

I've fixed this quite simply. Just change the first line of resetState() method to:

private void resetState() {
        joiningFractions = new float[pageCount == 0 ? 0 : (pageCount - 1)];

the default implementation is:

joiningFractions = new float[pageCount - 1];

and it caused exception when pageCount was 0

Alexia8 added a commit to Alexia8/InkPageIndicator that referenced this issue Oct 11, 2017
Added the fix already proposed by Zhelyazko for the bug in this library related to the issue "Page count could be zero which causes crash": DavidPacioianu#19 . I'm using this in the App i'm developing and instead of including the library in my project it makes sense to just update it here :-)
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