Skip to content

Commit ece36de

Browse files
committed
Fix divide by zero
New version can return page size of zero, seems to be when empty
1 parent cb003bc commit ece36de

File tree

1 file changed

+5
-0
lines changed
  • mdbxjni/src/main/java/com/castortech/mdbxjni

1 file changed

+5
-0
lines changed

mdbxjni/src/main/java/com/castortech/mdbxjni/Env.java

+5
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,11 @@ public Stat stat() {
524524
public float percentageFull() {
525525
Stat stat2 = stat();
526526
EnvInfo info2 = info();
527+
528+
if (stat2.ms_psize == 0) {
529+
return 0.0f;
530+
}
531+
527532
long nbrPages = info2.getMapSize() / stat2.ms_psize;
528533
return (info2.getLastPgNo() / (float)nbrPages) * 100;
529534
}

0 commit comments

Comments
 (0)