diff --git a/modules/markup/markdown/transform_codespan.go b/modules/markup/markdown/transform_codespan.go index d4d2803a614..989d139d340 100644 --- a/modules/markup/markdown/transform_codespan.go +++ b/modules/markup/markdown/transform_codespan.go @@ -68,10 +68,11 @@ func cssColorHandler(value string) bool { } func (g *ASTTransformer) transformCodeSpan(_ *markup.RenderContext, v *ast.CodeSpan, reader text.Reader) { - if v.FirstChild() != nil && v.FirstChild() == v.LastChild() { - colorContent := v.FirstChild().Text(reader.Source()) - if cssColorHandler(string(colorContent)) { - v.AppendChild(v, NewColorPreview(colorContent)) - } + if v.FirstChild() == nil || v.FirstChild() != v.LastChild() { + return + } + colorContent := v.FirstChild().Text(reader.Source()) + if cssColorHandler(string(colorContent)) { + v.AppendChild(v, NewColorPreview(colorContent)) } } diff --git a/routers/api/v1/admin/user.go b/routers/api/v1/admin/user.go index b027a6450df..9441fe0c18e 100644 --- a/routers/api/v1/admin/user.go +++ b/routers/api/v1/admin/user.go @@ -287,7 +287,7 @@ func DeleteUser(ctx *context.APIContext) { // "$ref": "#/responses/validationError" if ctx.ContextUser.IsOrganization() { - ctx.APIError(http.StatusUnprocessableEntity, "target is an organization but not an user") + ctx.APIError(http.StatusUnprocessableEntity, "target is an organization but not user") return } @@ -547,7 +547,7 @@ func RenameUser(ctx *context.APIContext) { // "$ref": "#/responses/validationError" if ctx.ContextUser.IsOrganization() { - ctx.APIError(http.StatusUnprocessableEntity, "target is an organization but not an user") + ctx.APIError(http.StatusUnprocessableEntity, "target is an organization but not user") return }