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

Missing hasNext() Check Before Using next() in Iterator #681

Closed
Xiqinger opened this issue Mar 14, 2024 · 1 comment
Closed

Missing hasNext() Check Before Using next() in Iterator #681

Xiqinger opened this issue Mar 14, 2024 · 1 comment
Assignees
Labels
Milestone

Comments

@Xiqinger
Copy link

Describe the bug
The current implementation utilizes an Iterator without checking the hasNext() method before calling next(). This can lead to NoSuchElementException if there are no more elements in the Iterator.
The "printEvaluation" method in the "oops.OOPSevaluation" class utilizes the "elementos.hasNext" check to ensure that "first" has a value. However, it does not guarantee that "second" will have a hasNext() value of true.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
image
image

Additional context
To mitigate this issue, it is recommended to add a hasNext() check before accessing the "second" element, line 350 and line 327 .

@dgarijo
Copy link
Owner

dgarijo commented Mar 14, 2024

Thanks!!

@dgarijo dgarijo self-assigned this Mar 14, 2024
@dgarijo dgarijo added the bug label Mar 14, 2024
@dgarijo dgarijo added this to the v1.4.xx milestone Mar 14, 2024
@dgarijo dgarijo closed this as completed in 5c1f5a3 Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants