Skip to content

Commit a75e7cf

Browse files
author
dm.naumenko@gmail.com
committed
fix for issue 8: ArrayIndexOutOfBoundsException when both original and revision List is empty
1 parent 85ed946 commit a75e7cf

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/difflib/myers/MyersDiff.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ public MyersDiff() {
8989
*
9090
* Return empty diff if get the error while procession the difference.
9191
*/
92-
@Override
9392
public Patch diff(List<?> original, List<?> revised) {
9493
return diff(original.toArray(), revised.toArray());
9594
}
@@ -99,7 +98,6 @@ public Patch diff(List<?> original, List<?> revised) {
9998
*
10099
* Return empty diff if get the error while procession the difference.
101100
*/
102-
@Override
103101
public Patch diff(Object[] orig, Object[] rev) {
104102
PathNode path;
105103
try {
@@ -134,7 +132,7 @@ public static PathNode buildPath(Object[] orig, Object[] rev)
134132

135133
final int MAX = N + M + 1;
136134
final int size = 1 + 2 * MAX;
137-
final int middle = (size + 1) / 2;
135+
final int middle = size / 2;
138136
final PathNode diagonal[] = new PathNode[size];
139137

140138
diagonal[middle + 1] = new Snake(0, -1, null);

0 commit comments

Comments
 (0)