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

Bad logical expression in the insertRow method #109

Closed
mitsuki31 opened this issue May 30, 2024 · 1 comment
Closed

Bad logical expression in the insertRow method #109

mitsuki31 opened this issue May 30, 2024 · 1 comment

Comments

@mitsuki31
Copy link
Owner

There's a bad logic inside the body insertRow method on row index checker.

} else if (row < 0 || row > mRows) { // Check for the index is out of bounds
JMatrixUtils.raiseError(new InvalidIndexException(
String.format("Given row index is out of range: %d",
(row < 0) ? (row - mRows - 1) : row
)
));

It should be like this:

-    } else if (row < 0 || row > mRows) {  // Check for the index is out of bounds
+    } else if (row < 0 || row >= mRows) {  // Check for the index is out of bounds

Where the given row must be lower than (and not equals) to mRows (the total rows of the matrix).

Originally posted by @mitsuki31 in #108 (review)

@mitsuki31
Copy link
Owner Author

Moved the issue to #110

@mitsuki31 mitsuki31 closed this as not planned Won't fix, can't repro, duplicate, stale May 30, 2024
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

1 participant