Skip to content

Commit 30be434

Browse files
authored
fix possible divided by zero error (#1162)
1 parent 94a37bf commit 30be434

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

api/src/main/java/io/minio/PutObjectArgs.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,8 @@ private long[] partInfo(long objectSize, long partSize) {
9393
}
9494

9595
if (partSize > 0) {
96-
if (partSize > objectSize) {
97-
partSize = objectSize;
98-
}
99-
100-
long partCount = (long) Math.ceil((double) objectSize / partSize);
96+
if (partSize > objectSize) partSize = objectSize;
97+
long partCount = partSize > 0 ? (long) Math.ceil((double) objectSize / partSize) : 1;
10198
return new long[] {partSize, partCount == 0 ? 1 : partCount};
10299
}
103100

0 commit comments

Comments
 (0)