Skip to content

Commit d90e73b

Browse files
fix: avoid overflow error when computing overall progress
1 parent 18ce13a commit d90e73b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

db.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ module.exports = function db (dir, keys, opts) {
2727
var c = db.views[name].since.value
2828
current += (Number.isInteger(c) ? c : -1)
2929
}
30-
prog.current = ~~(current / n)
30+
// we use Math.floor to avoid overflow errors
31+
prog.current = Math.floor(current / n)
3132
// if the progress bar is complete, move the starting point
3233
// up to the current position!
3334
if (prog.start <= 0) {

0 commit comments

Comments
 (0)