activity: fix ip validity check (#159)

This commit is contained in:
Alexander Trost 2023-01-30 17:09:36 +01:00 committed by GitHub
parent 2d640209e5
commit 71fbd9271e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -49,7 +49,7 @@ func (ac *activityCron) Run(ctx context.Context) error {
for _, v := range activity { for _, v := range activity {
// Delete any activity that has an invalid IP address. This is a fix for // Delete any activity that has an invalid IP address. This is a fix for
// a bug that truncated the last octet of an IPv6 address in the database. // a bug that truncated the last octet of an IPv6 address in the database.
if err := net.ParseIP(v.IP); err != nil { if ip := net.ParseIP(v.IP); ip == nil {
ids = append(ids, v.ID) ids = append(ids, v.ID)
continue continue
} }