Fix blank string issue when time betwen 0 and 1000 miliseconds

This commit is contained in:
ceze88 2023-01-25 16:45:16 +01:00
parent 24bd582501
commit 4af95e794b

View File

@ -92,7 +92,7 @@ public class Methods {
public static String makeReadable(Long time) { public static String makeReadable(Long time) {
if (time == null) if (time == null)
return ""; return "1s";
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
@ -109,6 +109,8 @@ public class Methods {
sb.append(" ").append(minutes).append("m"); sb.append(" ").append(minutes).append("m");
if (seconds != 0L) if (seconds != 0L)
sb.append(" ").append(seconds).append("s"); sb.append(" ").append(seconds).append("s");
if (sb.length() == 0)
sb.append("1s");
return sb.toString().trim(); return sb.toString().trim();
} }