review some possible nil error panics (#20518)

Этот коммит содержится в:
Ibrahim Serdar Acikgoz
2022-06-23 12:54:46 +03:00
коммит произвёл GitHub
родитель 00016e3a4f
Коммит 4b5d56a8c2
3 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@@ -1658,10 +1658,14 @@ func (a *App) SendEmailVerification(user *model.User, newEmail, redirect string)
}
if _, err := a.GetStatus(user.Id); err != nil {
if err.StatusCode != http.StatusNotFound {
return err
}
eErr := a.Srv().EmailService.SendVerifyEmail(newEmail, user.Locale, a.GetSiteURL(), token.Token, redirect)
if eErr != nil {
return model.NewAppError("SendVerifyEmail", "api.user.send_verify_email_and_forget.failed.error", nil, eErr.Error(), http.StatusInternalServerError)
}
return nil
}
@@ -2310,7 +2314,7 @@ func (a *App) ConvertBotToUser(bot *model.Bot, userPatch *model.UserPatch, sysad
appErr := a.Srv().Store.Bot().PermanentDelete(bot.UserId)
if appErr != nil {
return nil, model.NewAppError("ConvertBotToUser", "app.user.convert_bot_to_user.app_error", nil, err.Error(), http.StatusInternalServerError)
return nil, model.NewAppError("ConvertBotToUser", "app.user.convert_bot_to_user.app_error", nil, appErr.Error(), http.StatusInternalServerError)
}
return user, nil