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:
parent
3652fda759
commit
09b403bea3
1 changed files with 6 additions and 1 deletions
7
token.go
7
token.go
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue