mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 05:10:19 +08:00
Fix crash in incremental ID.
This commit is contained in:
@ -145,7 +145,12 @@ func (c *ApiController) Signup() {
|
|||||||
id := util.GenerateId()
|
id := util.GenerateId()
|
||||||
if application.GetSignupItemRule("ID") == "Incremental" {
|
if application.GetSignupItemRule("ID") == "Incremental" {
|
||||||
lastUser := object.GetLastUser(form.Organization)
|
lastUser := object.GetLastUser(form.Organization)
|
||||||
lastIdInt := util.ParseInt(lastUser.Id)
|
|
||||||
|
lastIdInt := -1
|
||||||
|
if lastUser != nil {
|
||||||
|
lastIdInt = util.ParseInt(lastUser.Id)
|
||||||
|
}
|
||||||
|
|
||||||
id = strconv.Itoa(lastIdInt + 1)
|
id = strconv.Itoa(lastIdInt + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user