1
0
Fork 0
mirror of https://github.com/Luzifer/vault-otp-ui.git synced 2024-11-08 16:20:06 +00:00

Fix: Don't divide by zero

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-09-14 14:36:05 +02:00
parent 3652fda759
commit 09b403bea3
Signed by: luzifer
GPG key ID: DC2729FDD34BE99E

View file

@ -79,11 +79,16 @@ func (t tokenList) MinPeriod() int {
var m int = math.MaxInt32
for _, tok := range t {
if tok.Period < m {
if tok.Period != 0 && tok.Period < m {
m = tok.Period
}
}
if m == math.MaxInt32 {
// Fallback: Everything uses the default value
m = 30
}
return m
}