ソースを参照

add nil/length check when delete old login attempts

Marcus Efraimsson 7 年 前
コミット
e3b3062107
1 ファイル変更4 行追加0 行削除
  1. 4 0
      pkg/services/sqlstore/login_attempt.go

+ 4 - 0
pkg/services/sqlstore/login_attempt.go

@@ -44,6 +44,10 @@ func DeleteOldLoginAttempts(cmd *m.DeleteOldLoginAttemptsCommand) error {
 			return err
 			return err
 		}
 		}
 
 
+		if result == nil || len(result) == 0 || result[0] == nil {
+			return nil
+		}
+
 		maxId = toInt64(result[0]["id"])
 		maxId = toInt64(result[0]["id"])
 
 
 		if maxId == 0 {
 		if maxId == 0 {