Skip to content

Commit

Permalink
fix possible divided by zero error (#1162)
Browse files Browse the repository at this point in the history
  • Loading branch information
balamurugana authored Feb 18, 2021
1 parent 94a37bf commit 30be434
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions api/src/main/java/io/minio/PutObjectArgs.java
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,8 @@ private long[] partInfo(long objectSize, long partSize) {
}

if (partSize > 0) {
if (partSize > objectSize) {
partSize = objectSize;
}

long partCount = (long) Math.ceil((double) objectSize / partSize);
if (partSize > objectSize) partSize = objectSize;
long partCount = partSize > 0 ? (long) Math.ceil((double) objectSize / partSize) : 1;
return new long[] {partSize, partCount == 0 ? 1 : partCount};
}

Expand Down

0 comments on commit 30be434

Please sign in to comment.