mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-10-26 03:52:24 +00:00
fix NPE
This commit is contained in:
parent
e9fed7a488
commit
6c7cff4f16
2 changed files with 27 additions and 3 deletions
|
|
@ -46,8 +46,16 @@ func (like ForgeLike) Validate() []string {
|
|||
var result []string
|
||||
result = append(result, validation.ValidateNotEmpty(string(like.Type), "type")...)
|
||||
result = append(result, validation.ValidateOneOf(string(like.Type), []any{"Like"})...)
|
||||
result = append(result, validation.ValidateNotEmpty(like.Actor.GetID().String(), "actor")...)
|
||||
result = append(result, validation.ValidateNotEmpty(like.Object.GetID().String(), "object")...)
|
||||
if like.Actor == nil {
|
||||
result = append(result, "Actor my not be nil.")
|
||||
} else {
|
||||
result = append(result, validation.ValidateNotEmpty(like.Actor.GetID().String(), "actor")...)
|
||||
}
|
||||
if like.Object == nil {
|
||||
result = append(result, "Object my not be nil.")
|
||||
} else {
|
||||
result = append(result, validation.ValidateNotEmpty(like.Object.GetID().String(), "object")...)
|
||||
}
|
||||
result = append(result, validation.ValidateNotEmpty(like.StartTime.String(), "startTime")...)
|
||||
if like.StartTime.IsZero() {
|
||||
result = append(result, "StartTime was invalid.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue