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

Division by zero when filtering empty lists #35

Closed
FriedrichFroebel opened this issue Jun 20, 2020 · 0 comments
Closed

Division by zero when filtering empty lists #35

FriedrichFroebel opened this issue Jun 20, 2020 · 0 comments

Comments

@FriedrichFroebel
Copy link
Owner

FriedrichFroebel commented Jun 20, 2020

When trying to filter an empty list, an "Division by zero" error (ArithmeticException) is thrown. The culprit seems to be https://github.com/FriedrichFroebel/cmanager/blob/master/src/main/java/cmanager/list/filter/FilterModel.java#L20, which leads to 0 cores if the list has size 0 and therefore the division fails. We should probably check if the list is empty beforehand and return the original list if it is empty.

Steps to reproduce:

  1. Create a new empty list.
  2. Try to apply a filter.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant