Skip to content

Commit dbf4a8c

Browse files
committed
[lib] Fixed array copying issue in cluster map
1 parent 5bf7fb9 commit dbf4a8c

File tree

1 file changed

+5
-6
lines changed
  • tehreer-android/src/main/java/com/mta/tehreer/internal/layout

1 file changed

+5
-6
lines changed

tehreer-android/src/main/java/com/mta/tehreer/internal/layout/ClusterMap.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,12 @@ public int get(int index) {
4949

5050
@Override
5151
public void copyTo(int[] array, int atIndex) {
52-
System.arraycopy(this.array, offset, array, atIndex, size);
52+
if (array == null) {
53+
throw new NullPointerException();
54+
}
5355

54-
if (difference != 0) {
55-
int length = size();
56-
for (int i = atIndex; i < length; i++) {
57-
array[i] -= difference;
58-
}
56+
for (int i = 0; i < size; i++) {
57+
array[i + atIndex] = this.array[i + offset] - difference;
5958
}
6059
}
6160

0 commit comments

Comments
 (0)