- } 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).
There's a bad logic inside the body
insertRow
method on row index checker.https://github.com/mitsuki31/jmatrix/blob/ebd80dd78cc2eec1a34b2591f46c5d9ce0d5fc11/src/main/java/com/mitsuki/jmatrix/Matrix.java#L958-L963
It should be like this:
Where the given
row
must be lower than (and not equals) tomRows
(the total rows of the matrix).Originally posted by @mitsuki31 in https://github.com/mitsuki31/jmatrix/pull/108#pullrequestreview-2088119376