From 1d3f8d71e2242c54dbdc94f84d9ad1fc71408efc Mon Sep 17 00:00:00 2001 From: Jonathan Bernard Date: Sun, 28 Jun 2015 08:49:42 -0500 Subject: [PATCH] ConsoleProgressBar: Prevent max from being non-positive. --- build.gradle | 2 +- src/main/groovy/com/jdbernard/util/ConsoleProgressBar.groovy | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9eb3517..bac8ae9 100644 --- a/build.gradle +++ b/build.gradle @@ -2,7 +2,7 @@ apply plugin: "groovy" apply plugin: "maven" group = "com.jdbernard" -version = "3.7" +version = "3.8" repositories { mavenCentral() } diff --git a/src/main/groovy/com/jdbernard/util/ConsoleProgressBar.groovy b/src/main/groovy/com/jdbernard/util/ConsoleProgressBar.groovy index ddf6301..bb38c00 100644 --- a/src/main/groovy/com/jdbernard/util/ConsoleProgressBar.groovy +++ b/src/main/groovy/com/jdbernard/util/ConsoleProgressBar.groovy @@ -18,6 +18,9 @@ class ConsoleProgressBar { private String lastInfo = "" private long startTime + public void setMax(int max) { + this.max = Math.max(max, 1) } + void update(int value, String info) { if (value == 0 || startTime == 0) startTime = System.currentTimeMillis()