Prevent crashing when trying to register with an empty payload
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2020-06-21 20:54:46 +02:00
parent bfc4dd05ed
commit 150c3f032c
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
1 changed files with 3 additions and 0 deletions

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())