Browse Source

Prevent crashing when trying to register with an empty payload

feature/datetime
kolaente 5 months ago
parent
commit
150c3f032c
Signed by untrusted user: konrad GPG Key ID: F40E70337AB24C9B
1 changed files with 3 additions and 0 deletions
  1. +3
    -0
      pkg/routes/api/v1/user_add_update.go

+ 3
- 0
pkg/routes/api/v1/user_add_update.go View File

@ -45,6 +45,9 @@ func RegisterUser(c echo.Context) error {
if err := c.Bind(&datUser); err != nil {
return c.JSON(http.StatusBadRequest, models.Message{"No or invalid user model provided."})
}
if datUser == nil {
return c.JSON(http.StatusBadRequest, models.Message{"No or invalid user model provided."})
}
// Insert the user
newUser, err := user.CreateUser(datUser.APIFormat())

Loading…
Cancel
Save