Fix possible nil pointer access (#28428)

There could be a nil pointer exception if the file is not found because
that specific error is suppressed but not handled.
This commit is contained in:
KN4CK3R 2023-12-12 14:51:33 +01:00 committed by GitHub
parent 0a794b2bcd
commit ff5106d700
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 28 deletions

View file

@ -148,10 +148,7 @@ func BuildRepositoryFiles(ctx context.Context, ownerID int64) error {
return err
}
for _, pf := range pfs {
if err := packages_model.DeleteAllProperties(ctx, packages_model.PropertyTypeFile, pf.ID); err != nil {
return err
}
if err := packages_model.DeleteFileByID(ctx, pf.ID); err != nil {
if err := packages_service.DeletePackageFile(ctx, pf); err != nil {
return err
}
}