From e3b3062107841517a832a420325f7ed5dd6a3004 Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Fri, 8 Mar 2019 13:31:46 +0100 Subject: [PATCH] add nil/length check when delete old login attempts --- pkg/services/sqlstore/login_attempt.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/services/sqlstore/login_attempt.go b/pkg/services/sqlstore/login_attempt.go index ceff2394dce..fe77dd7e914 100644 --- a/pkg/services/sqlstore/login_attempt.go +++ b/pkg/services/sqlstore/login_attempt.go @@ -44,6 +44,10 @@ func DeleteOldLoginAttempts(cmd *m.DeleteOldLoginAttemptsCommand) error { return err } + if result == nil || len(result) == 0 || result[0] == nil { + return nil + } + maxId = toInt64(result[0]["id"]) if maxId == 0 {